I’ve trying to get the string after the string /Filter and the first
seen “>>” by using this regexp: /<<(.)/Filter(.)>>/im
The problem is that, there is two >> in the input and the regexp takes
until the last >> it detected. How can I make it to get only until the
first >> that it detects ?
AA> I’ve trying to get the string after the string /Filter and the first
seen “>>>” by using this regexp: /<<(.)/Filter(.)>>/im
AA> The problem is that, there is two >> in the input and the regexp
takes
until the last >>> it detected. How can I make it to get only until the
first >>> that it detects ?
Newbie here so take what I have to say with a grain of salt.
Your pattern is “greedy”. To turn it into a lazy pattern add a
question mark thusly …
/<<(.)/Filter(.?)>>/
(untested)
Ralph
Thanks for the reply.
Basically that’s what I need. Thanks for pointing me towards new options
like “greedy”. Because of that, I’ve been able to find new Ruby regex
reference like
Really appreciate that, thanks
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.