Regex asterisk is not working in specified manner [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 8 years ago.
Improve this question
the following regular expression disallows other than numbers and periods. [^\d+\.?\d*]
but test string we give 12** asd it result wrong it matches 12**.
how does it match asterisk.

the following regular expression disallows other than numbers and
periods.[^\d+.?\d*]
No, it doesn't do what you want.
it result wrong it matches 12**
I can't reproduce that. In-fact it matched a string except 12**
Here is the explanation from regex101.com. Putting all together don't make much sense.
/[^\d+.?\d*]/
Negated char class [^\d+.?\d*] matches any character except:
\d Digit [0-9]
+.? One of the following characters +.?
\d Digit [0-9]
* The character *
Note : *, ? and + don't have their special meaning inside [] and all of them are treated as literal character
Probably you are looking for
[0-9.]+

Related

Input mask wildcards in a PLC language, i need to represent 4 characters [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
How do i use wildcards in my input mask in a PLC language (structured text)?
^^[0-9][0-9][A-Z][2][0]
main()
{
barcodeData = getBarcode();
if (match(barcodeData, "^^[0-1][0-9][2][0][P]*"))
{do something
}
else{dosomethingelse
}
}
This seems like a regular expression. There * is not a wildcard but a quantifier. It means that the preceding character or group can occur zero or more times. . is a wildcard. It means any character except newline. [...] is a character set. It means any character from the set.
. is a wildcard for one character.
.* is a wildcard for any number of characters.
[.] means exactly one dot.
.{4} means four wildcards.
You can use sandboxes and cheatsheets like https://regexr.com/ to test your regular expressions.

Regex needed for this string in powershell [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 6 years ago.
Improve this question
I need a regex which can search in the below string
Version updated to 13.0.1700.943 by the build system. NO_CI
Output needed 13.0.1700.943
Use this regex
(\d+\.){3}\d+
Breakdown
(\d+\.): This is the first capturing group. It finds one or more digits followed by a dot. Note that in regex, this dot has to be escaped.
{3}: This quantifier means, it will match the previous expression three times. In your example, you had three such instances
\d+: The last number does not have a dot after it, so we write it after the previous group.
Just to add to Richard Hamiltons answer (which would also match an IPv4)
the quantifier's can also limit the number of required places to match exactly your example
\d{2}\.\d\.\d{4}\.\d{3}
For a range you can use \d{1,2} to match one or two digits.

Regular expressions matching strings that don't start with `A` or whitespace [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 my regular expression to match strings that don't start with the letter A or whitespaces.
I've tried ^-|^(^(\W|A).), but it doesn't work, any ideas why?
regular expression doesn't start with character A or whitespace
^(?![A\s])
To match the whole string, you need to add .*
^(?![A\s]).*
OR
^[^A\s].*
DEMO
Strings don't start with A or Space will match also the strings starts with hyphen -, so you don't need to specify the pattern for strings starting with hyphen.
You were close:
^[^ A]
[^ A] matches anything other than A or space
^ anchors the regex at start of the string
Regex Example

Use regular expression to find character sequences [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 am trying to write a regex expression that detects wheather any character sequence exceeds a specified threshold in a string
for example:
the string "aaaxyzbbbb" is valid if threshold = 4;
ValidateString(input strToValidate, int threshold)
{
}
Thanks in advance
You can use a pattern that looks something like (.)\1{N} where N represents some number which should be your threshold minus one.
The pattern means:
(.) - any character, capturing it in a group
\1 - followed by whatever was matched in the first group
{N} - match the previous thing N times
So, for example, (.)\1{3} means any character followed by three more of the same character.

Regex - Without Special Characters [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 1 year ago.
Improve this question
I'm using regex to validate username
^[a-zA-Z]+\.[a-zA-Z]{4,10}^'
Unfortunately it doesn't affect if the the value contains special characters such as !##$%^&*)(':;
I would glad to get some help for Regex that contains:
Alphanumeric only (a-zA-Z0-9)
Length between 4 - 10 characters.
The conditions you specified do not conform to the regexp you posted.
the regexp you posted ^[a-zA-Z]+\.[a-zA-Z]{4,10}^ is erroneous I guess, because of the ^ in the end, it will never be matched to any expression, if you want to match with the ^ at the end of the expression, you need to escape it like this \^. but ^ alone means "here is the start of the expression", while $ means "here is the end of the expression".
Even though, it denotes:
It starts with alpha (at least 1).
there must be a '.' period character.
Now there must be at least 4 alphas.
The regexp you need is really is:
^[a-zA-Z0-9]{4,10}$
This says:
It starts with alphanumeric.
There can be minimum of 4 and maximum of 10 of alphanumeric.
End of expression.
Try this:
^[a-zA-Z0-9]{4,10}$