0

Using this regex ;(31055\d*)|^;\d{10}(\d{7}) How do I get the second part of the regex after the "|" to report as Group 1 using the test string of ;1000000000146691301? The regex is working but I need the ;1000000000144691301? to match to 1446913 in Group 1 not group 2. I need both matches to come out in group 1. The first part of the regex works using ;3105540001042017? and reports in Group 1.

0

How about (?|;(31055\d*)|^;\d{10}(\d{7}))

This requires Branch Reset Group which is not available in JavaScript, so depending on what language you are using, it may not work.

Working example: https://regexr.com/3tlk1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.