simple Regex does not match

  • Thread starter Thread starter jake
  • Start date Start date
J

jake

I am not very good with regular expressions, so can somebody please
tell me why this simple Regex pattern

"<!DOCTYPE ONIXmessage*>"

does not match the string

"<!DOCTYPE ONIXmessage SYSTEM http://www.editeur.org/onix/2.1/short/onix-international.dtd>"
?

but this pattern does

"<!DOCTYPE ONIXmessage*" ?

Notice the omission of the greater-than character ">".

The complete line of code is

bool goodMatch = (new Regex("<!DOCTYPE ONIXmessage*>")).IsMatch("<!
DOCTYPE ONIXmessage SYSTEM http://www.editeur.org/onix/2.1/short/onix-international.dtd>")

Your help is greatly appreciated.
jake
 
"<!DOCTYPE ONIXmessage*>"
^^ here you say: zero or more 'e'

I guess you want to look for "<!DOCTYPE ONIXmessage.*>"
zero or more characters (any) ^^

Cheers,
Udo
 
Thank you Udo,
Got it. It works now.
jake

^^ here you say: zero or more 'e'

I guess you want to look for "<!DOCTYPE ONIXmessage.*>"
zero or more characters (any) ^^

Cheers,
Udo
 
Back
Top