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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:08:26+00:00 2026-06-11T22:08:26+00:00

I need to use a regular expression to validate a string (written in spanish)

  • 0

I need to use a regular expression to validate a string (written in spanish) that represents a full date string… I don’t need to validate if the actual string is a valid date (leap years, etc…)

The string looks like this:

23 de septiembre del 2003

23 de septiembre de 1965

If the year is greater then 2000, the the word ‘del’ is use prior to the year, if not the word ‘de’ is use…

i did my research and found how to get the first 2 digits:

$pattern = ([0-9]+);

.. then i got lost on how to put it all together…

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-11T22:08:28+00:00Added an answer on June 11, 2026 at 10:08 pm
    /\b\d{1,2} de [a-z]+ (de 1\d{3}|del 2\d{3})/i
    

    Explanation:

    \b              ... requires a word boundary, since the following character is a digit
                        (and thus a word character) this will only match if the date is
                        preceded by a character that is not a letter, not a digit and
                        not an underscore
    \d{1,2}         ... one or two digits
    de              ... literally "de"
    [a-z]+          ... any letter from a-z, at least once but an arbitrary number of times
    (de 1\d{3}      ... literally "de" followed by "1" and 3 more digits
    |               ... or
    del 2\d{3})     ... literally "del" followed by "2" and 3 more digits
    
    i               ... make the whole thing case-insensitive (you can omit this if needed)
    

    Also note, that all spaces in the regex are treated just like any other character.

    Alternatively, instead of [a-z]+ you could specify a list of valid months like

    /\b\d{1,2} de (...|septiembre|...) (de 1\d{3}|del 2\d{3})/i
    

    (replace … with more month names an | to separate them)

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

Sidebar

Related Questions

I need a regular expression written to use in gVim that will remove duplicate
How to use regular expression in iOS sdk? I need to validate UITextField using
I need to use a regular expression that contains all the \b characters except
I need to parse the below string, and want to use regular expression but
The following regular expression is in use to validate email addresses: ^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$ I need
I need to use a long string for testing regular expression. However, the test
I need to use the following regular expression to validate some Asian characters $regexp
I don't usually use regular expressions, hence my question. I need a regex to
I have the following text: abcabcabcabc<2007-01-12><name1><2007-01-12>abcabcabcabc<name2><2007-01-11>abcabcabcabc<name3><2007-02-12>abcabcabcabc<name4>abcabcabcabc<2007-03-12><name5><date>abcabcabcabc<name6> I need to use regular expressions in order
hi i want to use regular expression with this kind of string, but i

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.