regex


Need a modification in the regular expression


I have regular expressions
'\d{2}[-/.]\d{2}[-/.]\d{4}' # For dd-mm-yyyy or dd/mm/yyyy or dd.mm.yyyy.
But, it is also pulling out dd-mm.yyyy or dd/mm-yyyy from the string. I need a strict match for the dates i.e. dd-mm-yyyy or dd/mm/yyyy or dd.mm.yyyy.
You can use this:
\d{2}([-/.])(\d{2}|[a-zA-Z]{3})\1\d{4}
([-/.]) will match -, / or . as a group, and \1 anywhere in this regex will refer to the same text matched by the group.
See demo here.

Related Links

Symfony2 IBAN Validator returns false for valid UK IBAN
Regex to find anchor tags which are without http or https in the href attribute
What's the difference between [:space:] and [:blank:]?
Regex to replace &nbsp with
How do I replace one or more whitespace characters using the replace() function in XQuery?
.htaccess Pretty URL not displaying correctly with redirection
regex replacing several special characters
Creating a delimited text using regex
Perl regex with a negative lookahead behaves unexpectedly
Regex Get path name from full path
Replacing comma's by dots in floats using regular expressions
Visual Studio 2012 Regexes
regEx search/replace variable name without preceeding “_”
Perl regex script and command line different
Combine Multiple Regexp Patterns
Regular expression for alphamumeric value and can contain hyphen

Categories

HOME
asp.net-mvc
f#
web-services
hortonworks-data-platform
varnish
afp
base
marketplace
sparkpost
openmodelica
vulkan
editor
resolve
calabash-android
deserialization
qualtrics
snort
gyroscope
man
c-strings
broker
confidence-interval
spring-batch-admin
nested-loops
phonegap-desktop-app
mediacodec
feedly
rdf4j
jsplumb
nib
jformattedtextfield
gridstack
api-doc
ubuntu-server
bem
sagepay
message-hub
psychopy
using
tern
zuul
ms-jet-ace
arm7
sharpziplib
harvest-scm
webloadui
autogen
manifoldcf
replicate
jeditorpane
sizing
ipopt
amazon-dynamodb-streams
turnjs
directsound
mutation
multiple-files
subroutine
genetic
wand
materialdrawer
python-dragonfly
post-processor
many-to-one
telescope
node-orm2
translucency
keypad
react-rails
linegraph
odoo
diagonal
gcovr
information-schema
bitrock
knockout-mvc
iqueryable
controlsfx
tinkerpop-frames
master-theorem
windward
tlb
preon
micro-orm
polarssl
datapump
12factor
sender
mixing
teamcity-7.0
force.com
nstreecontroller
system-tray
myisam
custom-protocol
xtratreelist
dynamic-websites
newsgroup
nhaml

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App