regex - Ruby Reg Ex Identify Pipe Within Quotes -
i want regex identify pipe characters within double quotes.
i using
\".+\|.+\"
which correctly matches on '1|some "quote | text"|4' , correctly not match on '1|some "quoted" text|4'
however, matches on '1|some "quoted" text|4|5|6|more "quoted" text|9' because there 2 sets of quotes - sees outer-most quotes , pipes between.
how alter regex not match in case?
update: turns out need match on multiple pipes within quotes. had been using:
/\"([^|]+)\|([^|]+)\"/
which works 1 pipe within quotes, such "1|some "quote | text"|4", need match on "1|some "quote | text | | pipes"|4".
any ideas???
instead of using .+
matches character, want match character except |
. want [^|]+
. based on have written, should want.
ruby regex
No comments:
Post a Comment