regex - Dart RegExp: single pass with multiple patterns? -


If I have a consortium of two or more sub-reggaxens, then search for a string of matches for a raggeon, So there is no way

For example, if I have the code:

  var regExp = new RegExp ('ab | cd)'); Var matches = regExp.allMatches ('absolutely fantastic');  

Search returns to two matches - but for me there is no way to know which sub-regeses match?

to find the answer for the branch.

  var regExp = new RegExp ('(ab) | (cd)'); // bracket important var matches = regExp.allmatches ('absolutely fantastic'); Var M1 = Match. Fast; Print (m1.group (1)); // 'ab' print (m1.group (2)); // tap, has not been matched since the second term (cd) var m2 = match.last; Print (m2.group (1)); // tap, as the previous pattern is not printed (m2.group (2)): // 'AC'  

Other useful information


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -