Regex:
start\_[a-z0-9]{3,}\_[a-z0-9]{3,}\.txt
what i think it means:
question:
can anyone confirm this behavior? I am able to verify pretty much everything via good except for what "{3,}" means. Any help is greatly appreciated!
-tsnm
A few comments -
start\_ should be ^start\_. That way you are assured its the
start of the string (and not potentially the middle)[a-z0-9]{3,} is any lowercase alphanumeric character. If you want uppercase also you should make it [a-zA-Z0-9]. Also if you want it to be greater than 3 (and not equal to) make it {4,}\.txt$. Without my suggestions, this would match -
blahblahlbahstart_abc123_abc123.txtblahblahblah
And this would not -
start_ABC123_ABC123.txt
Also, '_' is not a special character for regexes. This means it should not be escaped by a \. So your final regex should be -
^start_[a-zA-Z0-9]{4,}_[a-zA-Z0-9]{4,}\.txt$
You're very close. Let's take this in turn, as you did:
start\_match on any string that begins with "start_"
Correct.
[a-z0-9]{3,}then has alphanumeric substring greater than 3 characters
Close. It means "has alphanumeric substring 3 characters or more".
\_then separated with an underscore
Correct.
[a-z0-9]{3,}then has alphanumeric substring greater than 3 characters
Again, close. It means "has alphanumeric substring 3 characters or more".
\.txtfinally has a ".txt" extension
Correct.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With