Answer the question
In order to leave comments, you need to log in
How to get a given fragment from a string?
Good afternoon! Need help writing a regular expression.
There is this line: test-tes241-text-0123-2-5937-5172473
You need to get this fragment: -5937-5172473 (The format is always the same, just the numbers are different)
ps I need this for a js script, I need to check for the presence data at the end of the line.
Answer the question
In order to leave comments, you need to log in
While it is calculated to what sign, there is a suspicion that regex is not needed here?
UPD "the numbers are different" - if the number is different, then break it into parts by "-" and take the last two, if the number is the same, then generally just take this number from the end of the line.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question