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

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.