Regular expression for validating special characters Softwar camera sйx 3d

Rated 4.14/5 based on 523 customer reviews

We want to allow the username to contain letters, numbers, underscores and hyphens.

We also want to limit the number of characters in username so it does not look ugly.

The order of the character range inside square bracketsdoesn’t matter.

For example, the regular expression Test the regular expression In general, the caret symbol represents the start of the string, but when it istyped after the opening square bracket it negates the character set.

Lookaheads are used when we have the condition that this pattern is preceded or followed by another certain pattern.

Some meta characters have a special meaning and are written inside square brackets.

The meta characters are as follows: Test the regular expression Character sets are also called character class. Use a hyphen inside a character set to specify the characters’ range.

try below if you want to remove special character string str File Name = "DAs sandeep -_"; str File Name = Regex.

Replace(File Name, @"[^A-Za-z0-9-_ ]", ""); If you want to use regular expression use below, Mark as Answer if it helps.

Leave a Reply