I want to write a regular expression so that I match only the first number NOT, enclosed in square brackets.
eg. asdadsas,*&(*&(*2asdasd*U(*&*()&(*3 must match 2 (without square brackets)
and asdadsas,*&(*&(*[2]asdasd*U(*&*()&(*3 must match 3
The regular expression that I still have is: (?<!\[)[0-9](?!\])
However, the problem is that [2 must match 2.
I only want to skip the number if it has [ left and a ] right.
I do not know how (or, if possible, it is possible) to implement similar conditional logic in a regular expression.
source share