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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:19:30+00:00 2026-06-09T23:19:30+00:00

I need a little help I want to check if input matchs with the

  • 0

I need a little help I want to check if input matchs with the mask

Mask is this: 12.345.678/9012-34 (xx.xxx.xxx/xxxx-xx)

What I’ve tried till now is this

$string = '12.345.678/9012-34';

if(!preg_match('/^[0-9]{2}.[0-9]{3}.[0-9]{3}/[0-9]{4}-[0-9]{2}$/', $string)) {
     echo 'Doesnt match the mask!';
}

It didn’t work out. Thanks for any help.

  • 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-06-09T23:19:32+00:00Added an answer on June 9, 2026 at 11:19 pm

    You need to escape the / and . literals you want to match, as you’re using the former for the regex delimiter and the . has special meaning in a regex (generally to match all chars except \n).

    if(!preg_match('/^\d{2}.\d{3}\.\d{3}\/\d{4}-\d{2}$/', $string)) {
         echo 'Doesnt match the mask!';
    }
    

    I also used \d instead of [0-9] as it’s less to read and comprehend and they mean the same thing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need a little help getting this script doing what I want it to.
Need a little help with my jquery here I want all my button with
I need a little help with my .htaccess before I deploy it! I want
Need a little help again. Say I have an unordered list, and I want
Need a little help with string formatting... I have a string like this: Bmw
I need a little help with something that I want to achieve. A want
Hi I really need little help with my dynamic table Timesheet . I want
I am an xml newbie and need a little help. I want to extract
Need a little help from you guy's. I am making a check where element
Need little CSS help! I want to unhide a elements when another element is

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.