How to match any non white space character except a particular one ?

How to match any non white space character except a particular one ?

Asked on January 8, 2019 in Regex.
Add Comment


  • 2 Answer(s)

    Use a character class:

    /[^\s\\]/
    
    

    Above code will matches anything that is not a whitespace character nor a \.

    And also try this:

    [abc] means “match a, b or c“; [^abc] means “match any character except a, b or c“.

     

    Answered on January 8, 2019.
    Add Comment

    Use a lookahead for match any non white space character except a particular one:

    /(?=\S)[^\\]/
    
    

     

    Answered on January 8, 2019.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.