c# - Making a conditional regular expression -
c# - Making a conditional regular expression -
i have troubles making regexp:
i want regexp test fail if input contains symbol "<"
straight followed letter, i.e like: <[^a-za-z]
but want work if "<"
not found. how can that?
edit: examples
<wrong illustration wrong <example illustration < illustration < illustration good< illustration example<
edit 2: when working asp.net, can't send form text in input example:
<previous
edit 3: regular look passed in command cannot change, , works validating input regular expression. hence cannot match bad input
a negative lookahead regex on own like
^(?!.*<[a-za-z])
would check letter never followed left angle bracket, empty string match criteria. need create sure contains @ to the lowest degree 1 alpha, this?
^(?!.*<[a-za-z]).*[a-za-z]
in perl:
while (<data>) { print if /^(?!.*<[a-za-z])/; } __data__ <wrong illustration wrong <example illustration < illustration < illustration good< illustration example<
output
good illustration < illustration < illustration good< illustration example<
c# asp.net .net regex
Comments
Post a Comment