simple Regex does not match

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
 
U

Udo Nesshoever

"<!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
 
J

jake

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top