A
A
Artem00712017-09-23 10:32:50
Regular Expressions
Artem0071, 2017-09-23 10:32:50

Can't figure out a regular expression?

It used to be:
`goTo_1_2_3` and a regular expression with which to get numbers: /goTo_(\w+)/g
Now the numbers have been replaced with letters with '-'
It turns out something like this:

goTo_6f7aaaab-8a2b-4654-9a51-eb590ec0f2b4_1_ddb34756-8194-4e5a-8aa9-12a755eff6c1

How to split this expression into an array of 3 elements, which will be split into elements by underscore?
PS. I would do the usual splitting into elements, but there are other "phrases" in the line.
That is, the line itself looks like this:
param-out goTo goTo_6f7aaaab-8a2b-4654-9a51-eb590ec0f2b4_1_ddb34756-8194-4e5a-8aa9-12a755eff6c1 goTo-1

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2017-09-23
@Artem0071

/goTo(_[\S_]+){3}/g
https://regex101.com/r/sAoC72/1
Or like this if separate groups are needed:
https://regex101.com/r/sAoC72/2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question