Pattern Matching Using Regular Expression
A regular expression is a string which contains some normal characters and some meta characters. The meta characters include,
. means any character [c1-c2] means any character between c1 and c2 (c1 and c2 are two characters) [^c1-c2] means any character not between c1 and c2 (c1 and c2 are two characters) * means the character before it can occur any times + means the character before it can occur any times but at least one times \ means any character follow should be treated as normal character
You are to write a program to find the leftmost substring of a given string, so that the substring can match a given regular expression. If there are many substrings of the given string can match the regular expression, and the left positions of these substrings are same, we prefer the longest one.
.* asdf f.*d. sefdfsde [0-9]+ asd345dsf [^\*-\*] **asdf**fasd b[a-z]*r[s-u]* abcdefghijklmnopqrstuvwxyz [T-F] dfkgjf end
(asdf) se(fdfsde) asd(345)dsf **(a)sdf**fasd a(bcdefghijklmnopqrstu)vwxyz dfkgjf