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 3305664
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:11:47+00:00 2026-05-17T21:11:47+00:00

I got this issue figuring out how to build a regexp for verifying a

  • 0

I got this issue figuring out how to build a regexp for verifying a netbios name. According to the ms standard these characters are illegal
\/:*?”<>|

So, thats what I’m trying to detect. My regex is looking like this

^[\\\/:\*\?"\<\>\|]$

But, that wont work.

Can anyone point me in the right direction? (not regexlib.com please…)
And if it matters, I’m using php with preg_match.

Thanks

  • 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. Editorial Team
    Editorial Team
    2026-05-17T21:11:47+00:00Added an answer on May 17, 2026 at 9:11 pm

    Your regular expression has two problems:

    1. you insist that the match should span the entire string. As Andrzej says, you are only matching strings of length 1.
    2. you are quoting too many characters. In a character class (i.e. []), you only need to quote characters that are special within character classes, i.e. hyphen, square bracket, backslash.

    The following call works for me:

    preg_match('/[\\/:*?"<>|]/', "foo");  /* gives 0: does not include invalid characters */
    preg_match('/[\\/:*?"<>|]/', "f<oo"); /* gives 1: does include invalid characters */
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This issue came up when I got different records counts for what I thought
So I've got this issue with forms generated by Zend Framework. As we know
I've read many posts about this issue but I never got this to work.
I am desining a database and got stuck with this issue: My case is
I'm using CloudMade on iPhone and I've got this really critical issue to solve.
I got several questions regarding this issue 1) ActiveMQ after installed and started also
I've got this issue with my WPF application -- I'm using an ObservableCollection<T> to
I've got this issue. A template called checkbox that's called from while inside a
I got this error today when trying to open a Visual Studio 2008 project
I got this output when running sudo cpan Scalar::Util::Numeric jmm@freekbox:~/bfwsandbox/sa/angel/astroportal/dtu8e/resources$ sudo cpan Scalar::Util::Numeric [sudo]

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.