Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

ruby non greedy regex

the "?" makes the regex non greedy:

Example 2: Non-Greedy:
Regex: <h[0-9]>.*?</h[0-9]>
Input: <h3>My Title</h3>
<h[0-9]> matches: <h3>
.*? matches: My Title
</h[0-9]> matches: </h3>
Source by robertpyke.blogspot.com #
 
PREVIOUS NEXT
Tagged: #ruby #greedy #regex
ADD COMMENT
Topic
Name
5+5 =