ATR Posted September 26, 2014 Posted September 26, 2014 Hi all, My problem is to recover the last digits betwen <strong>.....</strong> tags. For example my text is like this : <div class="blockTooltip bd"> <div class="boxRoundTopL"> <div class="boxRoundTopR"> <p><strong>Sign of picto 12/04/2013</strong></p> <strong>.459/4814/310</strong> </div> <div class="boxRoundBottomL"> <div class="boxRoundBottomR"> </div> </div> I want recover 4594814310. I tested my regex with $ anchor but it doesn't work. $p = StringRegExp($Text, '(?is)<strong>([d]+)$', 1) Thanks in advance
kylomas Posted September 26, 2014 Posted September 26, 2014 ATR, Try this... #include <array.au3> local $str = fileread(@scriptdir & '\xml number.txt') $str = stringregexpreplace($str,'(?s).*\.(\d+)/(\d+)/(\d+).*','\1\2\3') ConsoleWrite($str & @CRLF) kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill
Solution mikell Posted September 26, 2014 Solution Posted September 26, 2014 (edited) $str = stringregexpreplace($str,'(?s).*>\.|\D*',"") Edit BTW the $ anchor won't work here as "Outside a character class, the dollar matches at the end of the subject text, and also just before a newline sequence if option (?m) is active." and the ([d]+) match - meaning following digits - will stop at the first non-digit encountered Edited September 26, 2014 by mikell
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