regex


How to check character repetition in string?


Hi guy's I am new to the regex and i am trying the create the expression for the pattern of the string value the rules are as below
1) String must start with the 'O' or 'T'
2) After that there must be 9 digits
3) After that there must be 'T'
4) After that alphanumeric string with specs and numbers and character'D' these can repeat any number of time in string of length 25
5) Then character 'O'
6) Then string with numbers and spaces of length 5
However i am done with the all the conditions but for the condition 4 i am not sure how to do it because it can repeat 'D' any number of times in given string with length 25. Write now i have adjusted the optional 'D' at every place where it present in the string that is kind of very lengthy regex so I was hoping some one would help me with condition 4 .Any help would be great.
The string to match -->
T011600062TO51D45D0399D0O 1807
The latest regex -->
(?x)((?:[OT]\d{9})(?:T\s*\d*\s*[0-9DO ]\d*\s*[OD0-9 ]\s*\d*[D0-9]\s*\d*[0-9OD ]\d*)(?:[O]\s*\d*)\b)
I am confused about this part of regex
(?:T\s*\d*\s*[0-9DO ]\d*\s*[OD0-9 ]\s*\d*[D0-9]\s*\d*[0-9OD ]\d*)
is this the correct way ?
You can try this for the all your matching pattern ,
(O|T)\d{9}T[DO \d]{0,25}O[\d ]{5}
Condition 4 is not clear.
(O|T)\d{9}T[D\d]{25}O[\d ]{5}
Maybe is D{0,25}. it means D repeated 0~25 times.

Related Links

Regex with lookaround for Lazarus
codeigniter regular expression for uri slug in routes
regex to match strings not preceded by a bang
What would the regex to match the hostname of this string?
How do I do a regex search and replace in sublime text 2?
Why are these regular expressions different?
r regex mileage
What is the complexity (Big-O) of searching an indexed data in mongoDB?
Filtering multiline pcregrep match with sed
How to remove a word prefix using grep?
How to create a regexp that catches everything that isn't a pure number
Print text at end of semicolon Sed/awk
Perl script, find first half of string [closed]
Perl regular expression to find a exact word
Check user input is valid CSS width value
the wonders of converting ereg_replace to preg_replace

Categories

HOME
elastic-beanstalk
codeigniter
vb.net
ffmpeg
clojure
vr
android-activity
styling
mocha
antlr4
box
gluon
zebble
oracle-ucm
atmelstudio
stackexchange-api
html-email
h.264
datamatrix
netcdf
eonasdan-datetimepicker
precision
epicorerp
physics
pdfa
toolbar
launchpad
arduino-esp8266
asana-api
directx-12
chai
ollydbg
haxm
google-crawlers
folly
docker-image
worldpay
tern
program-slicing
rating-system
arm7
soql
harvest-scm
catalina
lcov
facebook-canvas
ipmi
informatica-cloud
vb4android
post-increment
sql-server-2016-express
securesocial
groups
vb6-migration
scrutinizer
screen-capture
xelement
metalkit
domo
ironmq
protected
node-orm2
windows-universal
wso2as
zim-database
centering
express-jwt
css3pie
data-dictionary
showcaseview
emacs-jedi
chomsky-hierarchy
qdebug
chromeless
html5-apps
applaud
guvnor
arden-syntax
obout
stumbleupon
bubble-popup
ssao
replay
nstreecontroller
servletunit
wiki-markup
alivepdf
iphone-sdk-3.1
gendarme
development-machine

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