Why the regex doesn't catch "Extra" group? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Why the regex doesn't catch "Extra" group?

senglorysenglory Posts: 1Member
The regex:

[code]
# Region

s*Region:s*
(?.+?(?=))
s*

s*


s*

#Optional AD
(

s*

s*
]*?)>
(?:.+?)
s*s*
){0,1}


s*

(
# Amenities
]*?)>
s*

(?:.+?)

(?.+?)

s*

){0,1}



(?:.+?)

#Extra
(

s*(?.+?)s*

){0,1}
[/code]


The text to be processed:

[code]

Drive
Front


Transm
Mech


Intr
Leather



COND/td>
USED


Region/td>
QQQQQQQQQQQQQ




What's inside



    • ABS

    • Acs

    • HUD

    • Immo



    • Chairs

    • Alarm





Extra info


Good condition. Assembled in ---------

[/code]

Why doesn't it return me "Good condition. Assembled in ---------" for "Extra" group? This group is actually optional; that's why I marked it with {0,1}. And if I remove {0,1} the regex returns me it's expected value but only in this particular case.

What's wrong to my regex?

Sign In or Register to comment.