I'm new to regular expressions and I came across this:
/#zz([0-9]+)(.*)#zz/ig
What I understand so far is that whatever is written between #zz
and #zz
will be affected by the regular expression.
I understand that what it says from 0-9 refers to a number and the .* to a text string.
Can be? I wish I could understand her better.
The regular expression matches this pattern anywhere in the text:
This means that it will match all occurrences of a
#zz
, followed by at least one digit, up to the last occurrence on the same line of#zz
. Also, it will separately capture all the digits at the beginning, and the rest of the characters.demonstration:
For more information, I recommend you to see among the recommended links in the information of the regex tag: https://es.stackoverflow.com/tags/regex/info