Sign in to follow this  
Followers 0
ATR

RegEx help ($ anchor)

3 posts in this topic

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">&nbsp;</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

Share this post


Link to post
Share on other sites



#3 ·  Posted (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 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  
Followers 0