Determining both kinds of situations with Regex [closed] - regex

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 3 years ago.
Improve this question
The following regex code; after the number, it detects the period, but not if there is a space between the number and the text.
(\d+|d+\s)\.\s*([0-9a-zA-Z].*?)\s+([0-9a-zA-Z]\..*?)(?=\d+\.\s*[0-9a-zA-Z]|$)
Test this is first string and random digits:15*893 A.TEST B. TEST2 52.Test this is second string A.TEST B. TEST2 53 . This is 3th string A.TEST B. TEST2 54. this is next string.. A.TEST B. TEST2
Part 53 does not detect. What is the reason of this?
https://regex101.com/r/MqBcB6/2

You just need to allow for spaces between the digits and . where you check for them (at the start of the regex and in the lookahead):
(\d+)\s*\.\s*([0-9a-zA-Z].*?)\s+([0-9a-zA-Z]\..*?)(?=\d+\s*\.\s*[0-9a-zA-Z]|$)
Demo on regex101

Related

Return an entire word according to a subset of it with Regular Expression [closed]

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 3 years ago.
Improve this question
Suppose I have this string
str = "The rain in Spain"
And I want to return the first word that contains the two letters "ai" (i.e. "rain")
What must the regular expression be?
Following Regex can be used to find the first word in any given string
\w*ai\w*/m
/m param is for multi line & will return the first match
replace ai within the parenthesis to the required char matching for any string. i.e ab | we | slkd etc
Hopefully this will help you.

Regular expression for numeric range from -a to b where a is not equal to b [closed]

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
Let a and b be digits. The problem is easily solved if a=b, I can test the sign/no sign and then proceed to match the range of numbers from 0-a. I don't know how to solve this when the numbers are unequal.
How can I do it in python using a regular expression?
If you want for example between -7 and 4 :
(-[1-7]|[0-4])
Here is an example : https://regex101.com/r/8TnSVn/1

Regex Specific Match String [closed]

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
Would some one please tell me the following Regex?
At least eight or more characters.
At least one lower-case letter.
At least one upper-case letter.
At least one number.
Thanks in advance.
Variation on Complex Password Regular Expression
You can use this lookahead based regex:
^(?=.*?[a-z])(?=.*?[A-Z])(?=.*?[0-9]).{8,}$

Regex to match 1 to 10 digit number with any number of decimal Places [closed]

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 want a regex to match cost.
Valid cost-
1.1234455
12.434343
123.3333
..
upto 10 digits maximum..
and invalid is
0.545454
000.5435435
Here is a regex that will match any cost except those that have all zeros before the floating point
(?!0+\.)\d+\.\d+
http://regex101.com/r/pQ4kB3

regex: check if values exist in between commas [closed]

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
In Perl, I would like to determine if a given string is valid, the rule is to check if values exist between commas.
e.g. abc,abc is a valid case, but abc, or abc,,abc are not.
m/^\s*,|,\s*,|,\s*$/
matches all invalid combinations, assuming whitespace does not count as "values".