Here is my RegEx declaration.

private Regex rxPattern = new Regex("^(book-[a-z]{1}\z)");

I'm expecting it to match start of string "^" To end of string "\z"
But the "z" is causing the error.

I'm fairly new to RegEx and cannot find a solution, if anyone can educate me a little that would be smashing.

Thanks for reading.

(edit)

I swapped "\z" for "$" and it does not cause error.
But in another project I do use "\z" and it appear to work, but of course I probably just think it does.

Now I'm getting the same error, but on the "\d" with the following pattern.

public Regex rxPattern = new Regex("^(\d{1,5}$)");

(edit)
Duh! was missing "@"...

public Regex rxPattern = new Regex(@"^(\d{1,5}$)");

Same with other pattern.

Talking to yourself?

Absolutely not, that would be absurd.

I'm typing to myself :)

Just wanted to clear up the issue so not waste anyones time.

Fair enough. I don't know much about regex but I always remember the hat and dollar so could have answered this one!

Thanks, but just for clarification.

"\z" was just fine, as was "\d", the problem was my omissiom of "@".

Ok I see

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.