By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,670 Members | 1,563 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,670 IT Pros & Developers. It's quick & easy.

simple Regex does not match

P: n/a
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

Jul 14 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"<!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
Jul 14 '08 #2

P: n/a
Thank you Udo,
Got it. It works now.
jake

On Jul 14, 10:21 am, Udo Nesshoever <Brucklyn...@googlemail.com>
wrote:
"<!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
Jul 14 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.