Regex Or and Greedy -
i trying perform regex not sure how write or condition because of greedy behavior of regex.
some_text=(?<value>.*)&|some_text=(?<value>.*)$ the above regex want write better 1 following:
some_text=(?<value>.*)(?:&|$) but because of greediness, 1 not stopping value when encounters first & instead goes end of string.
thanks help
you can use negation regex:
some_text=(?<value>[^&]*) [^&]* match 0 or more of character not &
Comments
Post a Comment