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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 264k
  • Answers 264k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Nevermind, answered this myself two minutes after posting it. I… May 13, 2026 at 12:19 pm
  • Editorial Team
    Editorial Team added an answer I think you should try closest. This is new in… May 13, 2026 at 12:19 pm
  • Editorial Team
    Editorial Team added an answer As you may know, the templates in your export file… May 13, 2026 at 12:19 pm

Related Questions

I have the following regular expression for validating a file name: ^(([a-zA-Z]:|\)\)?(((.)|(..)|([^\/:*\?\|<>. ](([^\/:*\?\|<>. ])|([^\/:*\?\|<>]
I have a chunk of text like: Name=Long John Silver;Profession=cook;Hobby=Piracy And using the Boost::regex
I'm working on some homework for my compiler class and I have the following
As usual, regular expressions are causing my head to hurt. I have the following

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.