Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 160297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T11:00:36+00:00 2026-05-11T11:00:36+00:00

I have the following regular expression for eliminating spaces, tabs, and new lines: [^

  • 0

I have the following regular expression for eliminating spaces, tabs, and new lines: [^ \n\t]

However, I want to expand this for certain additional characters, such as > and <.

I tried [^ \n\t<>], which works well for now, but I want the expression to not match if the < or > is preceded by a \.

I tried [^ \n\t[^\\]<[^\\]>], but this did not work.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T11:00:36+00:00Added an answer on May 11, 2026 at 11:00 am

    Can any one of the sequences below occur in your input?

    \\>
    \\\>
    \\\\>
    \blank
    \tab
    \newline
    …

    If so, how do you propose to treat them?

    If not, then zero-width look-behind assertions will do the trick, provided that your regular expression engine supports it. This will be the case in any engine that supports Perl-style regular expressions (including Perl’s, PHP, etc.):

     (?<!\\)[ \n\t<>] 

    The above will match any un-escaped space, newline, tab or angled braces. More generically (using \s to denote any space characters, including \r):

     (?<!\\)\s 

    Alternatively, using complementary notation without the need for a zero-width look-behind assertion (but arguably less efficiently):

     (?:[^ \n\t<>]|\\[<>]) 

    You may also use a variation of the latter to handle the \\>, \\\>, \\\\> etc. cases as well up to some finite number of preceding backslashes, such as:

     (?:[^ \n\t<>]|(?:^|[^<>])[\\]{1,3,5,7,9}[<>]) 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following regular expression: ([0-9]+),'(.)':([0-9]+),(L|R|'.') It matches this just fine: 1,'a':1,R However,
I have the following regular expression with which I match a few lines. Here
I have a question about the following regular expression: I want to match the
I have this Regular Expression that matches the following strings: <!-- 09-02-2009 ---> <!--
I have the following regular expression: ^[[][A-Za-z_1-9]+[\]]$ I want to be able to get
I have the following regular expression: \[(\d+)\].?\s+(\S+)\s+(\/+?)\\r\n I am pretty new to regex. I
I have the following regular expression: (?:<(?<tag>\w*)>(?<text>.*)</\k<tag>>) I want it t grab the text
I have written following regular expression /^[A-Za-z0-9-_\s]*$/ in PHP which allows numbers, letters, spaces,
I have the following Regular Expression which matches an email address format: ^[\w\.\-]+@([\w\-]+\.)+[a-zA-Z]+$ This
I have the following regular expression /[^a-zA-Z0-9 ]/g I want include " in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.