jerem488 Posted August 12, 2014 Share Posted August 12, 2014 Hello, I have my string like this : <li class="hideTel"><strong>0800 43 67 34</strong></li> <li class="hideTel">fax: <strong>.03 80 43 88 37</strong></li> And I want only the result : <li class="hideTel"><strong>0800 43 67 34</strong></li> If ther is the word "fax" the regexp don't must return the string I have tested some regexp, but nothing works. I want to do this only with a regexp within pass with a condition stringinstr.. I want optimize the code. StringRegExp($text, '(?is)class="hideTel"(?:[fax])*(.*?)</li>' don't work StringRegExp($text, '(?is)class="hideTel"(?:fax)*(.*?)</li>', don't work StringRegExp($text, '(?is)class="hideTel"((?:fax).*?)</li>', dont work Thanks Qui ose gagneWho Dares Win[left]CyberExploit[/left] Link to comment Share on other sites More sharing options...
Solution mikell Posted August 12, 2014 Solution Share Posted August 12, 2014 #Include <Array.au3> $text = 'something' & @crlf & _ '<li class="hideTel"><strong>0800 43 67 34</strong></li>' & @crlf & _ '<li class="hideTel">fax: <strong>.03 80 43 88 37</strong></li>' & @crlf & _ '<li class="hideTel"><strong>0800 12 34 56</strong></li>' & @crlf & _ '<li class="hideTel">fax: <strong>.03 80 77 88 99</strong></li>' & @crlf & _ 'something else' $res = StringRegExp($text, '(?is)(class="hideTel">(?!\s*fax).*?</li>)', 3) _ArrayDisplay($res) ; get the phone numbers only $res = StringRegExp($text, '(?is)class="hideTel">(?!\s*fax).*?([\d\s]+)', 3) _ArrayDisplay($res) Link to comment Share on other sites More sharing options...
jerem488 Posted August 12, 2014 Author Share Posted August 12, 2014 Thanks a lot mikell ! Qui ose gagneWho Dares Win[left]CyberExploit[/left] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now