1

I'm having a bit of trouble getting a regular expression to work, I want it to get everything starting from a character and ending on the second instance of another character.

Ex. "matchVersion":"6.22.165.3566" should result in = 6.22

I have tried an answer that rvalvik posted here , regex match till a character from a second occurance of a different character , but it only solves part of the problem as shown below.

Example

(?<=:")[^:]+?(?=")

I would like the expresion to do someting like this instead.

Example

It have been trying to get everything after :" and before second occurance of .

Thanks for any help.

Community
  • 1
  • 1
Felipe Lopez
  • 396
  • 3
  • 11

1 Answers1

1

It have been trying to get everything after :" and before second occurance of .

You may use negated character class:

(?<=:")[^".]+\.[^".]+

See the regex demo

  • (?<=:") - asserts that there is a :" before the current position
  • [^".]+ - 1+ chars other than . and "
  • \. - a dot
  • [^".]+ - 1+ chars other than . and "
Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563