M
M
Max Yawo2018-04-28 23:01:30
Regular Expressions
Max Yawo, 2018-04-28 23:01:30

How to find a substring between two identical, arbitrary tokens?

I have strings of type Something $token Something$toke
tokencan consist of any characters. Tokens are not known in advance.
Tell me, is it possible to somehow find what is between two tokens using regexp, preferably with one regular expression?
To make it clearer:
from Hello $token world$tokenyou need to get world
from Hello $foo $bar 123 $fooyou need to get $bar 123
, etc.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nick Sdk, 2018-04-28
@Zlat1997

https://regex101.com/r/mZXjWx/1
"required" in group 2

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question