Jump to content
Sign in to follow this  

RegEx help ($ anchor)

Recommended Posts

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>


<div class="boxRoundBottomL">
<div class="boxRoundBottomR">&nbsp;</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

Share this post

Link to post
Share on other sites


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)


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

Share this post

Link to post
Share on other sites

$str = stringregexpreplace($str,'(?s).*>\.|\D*',"")



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 by mikell

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...