Community Patterns

Community Library Entry

1

Regular Expression
Created·2014-09-04 14:26
Flavor·PCRE (Legacy)

/
^([0-9]*)(\\*)$
/
Open regex in editor

Description

Based on my understanding of Regex, the string “10” matches the Regex “^([0-9])(\)$”. To validate it, I tried the regex and the text “10” on the website and it worked. But when I tried the same with C# code, it failed.Only by adding a "?", making the regex “^([0-9])(\)?$” makes the string "10" validate against the regex. I am confused why it behaves differently in the C# Regex class.

Submitted by anonymous