2008/6/24, cirfu <[EMAIL PROTECTED]>:
>
> I need to extract prices froma html-document.
>
> [0-9]*\$ matches 112$ 45$ etc but also just a $. why that shouldnt
> really matter and it is unlikely anyway to appear a $sign with no
> price attahced to it I still want to prevent it.
>
> How do I avoid matching "$"? It has to be "nbr$".
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
In this simple case you can simple use something like:

[0-9]+\$

ie. at least one digit immediately folowed by a dollar-sign

If you really needed to check for a preceding text, look into

look-behind assertions of the form  (?<=...) or (?<!...) (negative)

cf. http://docs.python.org/lib/re-syntax.html

hth,

 vbr
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to