Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
So i want to make a regular expression to validate times between 12:00 and 22:00 but i cant get my head around making expressions and cant find any examples online that i can just swap out examples of. Can anybody help me?
You can use the following regular expression:
^((1[2-9]|2[0-1]):[0-5][0-9]|22:00)$
This is how it works:
^ and $ match start and end of string, and they are there to prevent matching also 112:009 for example (which contains 12:00).
[2-9] matches numbers between 2 and 9, and (a|b) would match either a or b.
Debuggex Demo
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I need to validate the filenames before a upload. I thought regex would be the perfect solution for that, but I don't have a clue of regex.
The filenames have all a specific structure.
What I tried myself is: /([-\d]{2,})_([a-zA-Z\d]+)/, but this will only match the first numbers and the first tag in the filename.
Example: 100_test-tag1-tag2.gif or 100_test_tag1-tag2.gif
The files have to start with a number and after the number should be a underscore. After that it should at least have one part with a tag. The tags can be separated by a underscore or a hyphen. The tags can occur an infinite number of times. The file ending should be .gif.
Your attempt is almost complete:
Try this:
/([-\d]{2,})_([a-zA-Z\d]+)([_-][a-zA-Z\d]+)*\.gif/
I added this:
([_-][a-zA-Z\d]+)*
which matches an _ or - followed by a tag zero ore more times.
And
\.gif
which matches the trailing .gif.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I am new in programming. I want to implement phone number validation using javascript in my website. I want some regex with conditions below:
a digit with length of 11
it should start with 09
no any string or space in the input is accepted
e.g.
"09131234455" // is accepted
"091 05488963" // not accepted
thanks anyone can help!!
Try: ^09\d{9}$ (first '09', then 9 digits, all this surrounded with
"start of string" and "end of string" anchors).
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I have a sentence example: I am just one man I', trying to capture am just on with the following regex, but it also captures I which is not what I need.
(?=I).*(?= man)
The result is: I am just one
I don't want extra capturing groups, only the full match which should be am just one.
change the first positive lookahead to a negative (?!I). This won't capture I
(?!I).*(?= one)
By saying look and match anything except I
(?=[^I ]).*(?= man)
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I tried this : [fl]ady?[ing] ?[rb]ug!?
I know [fl]ad[y]?(ing)? ?[br]ug!? is an answer
Can this be solved using character sets only? Must match both.
ladybug
fading rug!
I believe this should work for you
[fl]ad(y|ing)\s?[br]ug?
Check out http://www.regexpal.com/
Using character sets only? So, it doesn't matter what other letter combinations it matches as well? Mmm. Then
[fl]ad[giny]+[\sbrug!]+
would do. See: https://regex101.com/r/FJWJyM/1
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm trying to write regexp to find a string who start and ends with the same number like so :
2aldkc2 <----
4alou4 <----
edit , i forget to motion what i have tried so far :
^(\d).^([^h].*$)
but this doesn't work
Use capturing group.
^(\d).*\1$
The regex captures the first digit and match that particular line only if the last character is also the same as the one captured.
DEMO