Got more questions? Find advice on: ASP | SQL | XML | Windows
Welcome to RegexAdvice Sign in | Join | Help

Need regex to omit <followedby> or white spaces

  •  04-01-2008, 2:06 PM

    Need regex to omit <followedby> or white spaces

    I am looking for a regular expression which should match the following criteria

    1. Input string should not contain <followed by>
    2. Input string should not contain white spaces.

    Below are the examples for which regex should return true/false (Regex.IsMatch(inputString))

    some<testhaspattern>thing - false
    s&*<te*&#df> - false
    test has space - false
    <test has space and pattern> - false
    test<test has space and pattern>test - false
    <testhaspattern> - false
    testhasnospace - true
    test*has&no#space - true
    test*has&no#spaces%and$special~charsare^ok - true

    So regex should return false if the input string contain <pattern> or white spaces or both. 

    Thanks in advance

    Filed under: ,
View Complete Thread