Answer the question
In order to leave comments, you need to log in
Regular expressions: only the first one found
We have a string:
02 00 00 91 1B 00 00 03 89 02 00 00 91 1B 00 00 03 89 02 00 00 91 1B 00 00 03 89 02 00 00 91 1B 00 00 03 89 02 00 00 0 0 2 00 91 1B 00 00 03 89 02 00 00 91 1B 00 00 03 89 02 00 00 91 1B 00 00 03
Regular expression:
00 00 (\d{2})((\s\S{2}){0,} )\s03\w?
The first "bracket" matches 91
The second should match "1B 00 00", i.e. stop at the first "03" found, but actually stop at the last "03".
As you can see in the source line, the same block is repeated.
How to use a regular expression to ensure that the data of the second bracket stops at the first 03 found. I tried everything I know - it doesn’t work.
The task should be solved only(!) with the help of regular expressions.
Regular expressions are used in javascript.
Answer the question
In order to leave comments, you need to log in
00 00 (\d{2})((\s\S{2})+?)\s03\w?
+? — 1 or more, ungreedy
Must look for what you need.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question