CodeIgniter Forums
PCRE - Match pound sign - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: PCRE - Match pound sign (/showthread.php?tid=28676)



PCRE - Match pound sign - El Forum - 03-18-2010

[eluser]richzilla[/eluser]
Hi All,


How would i match a pound sign in a regular expression?

so far ive tried the hex:

Code:
[\xA3]

and the ascii:

Code:
[\163]

however both of these return false for a valid price:

Code:
£125.22

Just for reference, the regex im running it against (in case ive made a mistake here):

Code:
/^[\xA3]?\s?[0-9]+(\.|\,)[0-9]{2}$/



PCRE - Match pound sign - El Forum - 03-18-2010

[eluser]sophistry[/eluser]
did you look at the regular-expressions.info site that i posted in the other thread you made about this regex?

when i clicked to that site i found a page describing something relevant:
http://www.regular-expressions.info/unicode8bit.html

cheers.