Regular expression ... matching '*' character

Posted by Sdj79 on Wed 14 Jul 2004 11:54 AM — 8 posts, 31,728 views.

Belgium #0
I was wondering how to match the * char

I'm trying to convert this
[*@@#######XXXXXXXXxxxx.........]

to numerical value ... my preblem is that i can't have * matched

A this time i've:
^[ ]*\[([\x2a]*)([\@]*)([\#]*)([X]*)([x]*)([\.]*)]$

which works perfectly but for the *

Can anyone help me?
Greece #1
Try escaping it with \*.
Belgium #2
That's the first thing i tried ... as it worked for other chars like '.'
But unfortunately that doens't seem to work with *
:s
USA #3
It DOES work with * though. Perhaps other parts of your expression are problematic?

Try a regexp with JUST \* (match on a single asterisk) then check keep evaluating, repeat on same line, regexp, and change the color of it. Just to see if it is indeed some problem with... well, I dont know, that prevents you from matching.
Canada #4
A this time i've:
^[ ]*\[([\x2a]*)([\@]*)([\#]*)([X]*)([x]*)([\.]*)]$

The * looks to be after the open [ but you have it before.
\[\*

The final ] does not appear to be escaped.
\]

^[ ]\[\*([\x2a]*)([\@]*)([\#]*)([X]*)([x]*)([\.]*)\]$

Maybe that one will work.
Belgium #5
you were right it's the @ matching that doesn't work :s
Trying to figure out why
Belgium #6
And found the solution ...
@ had to be matched using \x40

Thx for your help
USA #7
You dont need to escape the @, thats probably why its not matching. Actually no, thats not it. Do you have "expand variables" checked? (If so, why?) There shouldnt be anything wrong with matching on @ (unless you do have expand variables checked).