Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

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

Reply
 
Old 08-11-2009   #1 (permalink)
senglory


 
 

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

the regex:

# Region
<tr>
\s*<td\s+class="grey11">Region:</td>\s*
<td\s+class="b11\s+b">(?<Region>.+?(?=</td>))</td>
\s*
</tr>
\s*

</table>
\s*

#Optional AD
(
<div\s+class="wid342\s+fl\s+padtop15">
\s*
<div\s+class="linkicon\s+listicon\s+lh16">
\s*
<a(?:[^>]*?)>
(?:.+?)</a>\s*</div>\s*</div>
){0,1}

</div>
\s*

(
# Amenities
<div\s+class="wid342\s+fl\s+mtop10(?:[^>]*?)>
\s*
<div\s+class="pad10">
(?:.+?)
<ul\s+class="chkbox">
(?<Amenities>.+?)
</ul>
\s*
</div>
){0,1}



(?:.+?)

#Extra
(
<div\s+class="b10\s+lh16\s+vpad10">
\s*(?<Extra>.+?)\s*
</div>
){0,1}


the text:


<tr>
<td class="grey11">Drive</td>
<td class="b11">Front</td>
</tr>
<tr>
<td class="grey11">Transm</td>
<td class="b11 b">Mech</td>
</tr>
<tr>
<td class="grey11">Intr</td>
<td class="b11">Leather</td>
</tr>

<tr>
<td class="grey11">COND/td>
<td class="b11">USED</td>
</tr>
<tr>
<td class="grey11">Region/td>
<td class="b11 b">QQQQQQQQQQQQQ</td>
</tr>
</table>
</div>
<div class="wid342 fl mtop10" style="background:#F5F5F5">
<div class="pad10">
<h4 class="darkred">What's inside</h4>
<ul class="chkbox">
<li class="par">
<ul>
<li>ABS</li>
<li>Acs</li>
<li>HUD</li>
<li>Immo</li>
</li>
<li class="par">
<ul>
<li>Chairs</li>
<li>Alarm</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="wid342 fl oh">
<p class="vmargin10">
<h4>Extra info</h4>
<div class="b10 lh16 vpad10">
Good condition. Assembled in ---------
</div>






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?



My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Re: CSV and regex s.split(",") and empty fields VB Script
Can Wscript catch the MS Word Application Event "DocumentBeforePrint" ? VB Script
Persistent "extra linebreak" problem with Live Mail / Hotmail Live Messenger
microsoft.public.windowsxp.general posts reappear after "catch up" Live Mail
"Catch Up" vs. "Mark All Read" Vista mail


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46