Regex matches ini value

I am trying to combine the last name of the string value ini.

foo.bar.far.boo = "some value"

I can match "boo =", but I just need to "boo"

I do (\w+)\s*=, but it matches the equal signs, but I don't want it to match.

By the way, I should be able to get if there are no subsets, such as:

foo = "value"
+3
source share
1 answer

Using

\w+(?=\s*=)

(?=...)is a positive statement by lookahead , which means "to claim that a nested regular expression can be matched here, but don't make it part of the match itself."

, - , ( ) .

+3

Source: https://habr.com/ru/post/1793683/


All Articles