Is it possible, and how should regex look like to get everything after the closing bracket or get everything if there are no brackets at all?
possible input 1:
[12,45] some text
possible input 2:
expected to get:
I found something like lookbehing conditional, and tried:
but didn’t work.
This works for the input with brackets:
And this works for input without brackets:
but is it possible to get one expression to match both input cases?
This regex, you need
(?<=]\s|^)[\w\s]+ # ^ # | # there
The regular expression matches as follows:
||look behind to see if there is:|
||whitespace (\n, \r, \t, \f, and " ")|
||the beginning of the string|
||end of look-behind|
||any character of: word characters (a-z, A- Z, 0-9, _), whitespace (\n, \r, \t, \f, and " ") (1 or more times (matching the most amount possible))|