ruby - Regex help: Targeting text between *| and |* -
i'd love help me regex. i'd able isolate regex observe characters in string below between * | , | *:
hello "*|first_name||default_value|*" i appreciate help.
use this:
if subject =~ /\*\|\k.*?(?=\|\*)/ match = $& see demo.
\*\| matches *| \k tells engine drop matched far match report .*? lazily matches to... a point lookahead (?=\|\*) can assert follows |* reference
lookahead , lookbehind zero-length assertions mastering lookahead , lookbehind ruby regex
No comments:
Post a Comment