.*[^a-zA-Z0-9_].*
will match the entire input as long as there is a non-alphanumeric/underscore somewhere in the input. [^a-zA-Z0-9_]
will match only a single non-alphanumeric/underscore character (most likely the last one, if you’re using the default greedy matching) if it is somewhere in the input. Which one you want depends on the input and what you want to do once you find out if a non-alphanumeric/underscore character exists in the input.
Related Posts:
- Regex for numbers only
- Regex that accepts only numbers (0-9) and NO characters
- Regex for numbers only
- Regular expression “^[a-zA-Z]” or “[^a-zA-Z]”
- What is the simplest regular expression to validate emails to not accept them blindly?
- Remove punctuation from string with Regex
- How can I parse JSON with C#?
- How to fix No connection could be made because the target machine actively refused it 127.0.0.1:64527
- Converting string to byte array in C#
- How to use SQLite in Visual Studio 2017?
- How to convert byte array to string [duplicate]
- C# Java HashMap equivalent
- Configuration System Failed to Initialize
- Unity cannot convert from ‘string’ to ‘int’
- The request was aborted: Could not create SSL/TLS secure channel
- The located assembly’s manifest definition does not match the assembly reference
- Get current folder path
- foreach vs someList.ForEach(){}
- LEFT OUTER JOIN in LINQ
- How can I find a specific element in a List
? - What does question mark and dot operator ?. mean in C# 6.0?
- How to jump in Unity 3d?
- XAML Binding Groups
- Does not contain a static ‘main’ method suitable for an entry point
- Checking if an object is null in C#
- How to use Global Variables in C#?
- Unity3d no Monobehaviour scripts in the file, or their names don’t match the file name
- Add new item in existing array in c#.net
- How to fix file format and extension don’t match?
- Invalid length for a Base-64 char array
- The HTTP request was forbidden with client authentication scheme ‘Anonymous’. The remote server returned an error: (403) Forbidden
- Why am I getting a “Could not find a part of the path” exception?
- How to move 2D Object with WASD in Unity
- The Object you want to instantiate is null. Unity 3D
- Convert date yyyyMMdd to system.datetime format
- How to bind a model to a kendo Combobox in order to use the models validatation?
- HttpWebRequest-The remote server returned an error: (400) Bad Request
- MSHTML DLL on Windows 10
- Adding values to a C# array
- C#: how to get first char of a string?
- how to convert C# to C++
- Reading settings from app.config or web.config in .NET
- How to initialize a list of strings (List
) with many string values - Collection was modified; enumeration operation may not execute
- Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on
- Unity – Gameobject look at mouse
- What does the @ symbol before a variable name mean in C#?
- What is the C# version of VB.net’s InputDialog?
- How to add comments into a Xaml file in WPF?
- Reading CSV file and storing values into an array
- How to easily initialize a list of Tuples?
- How do I target @Model within a src of an image tag?
- How to round up in c#
- Converting from IEnumerable to List
- Escape double quotes in a string
- How to do constructor chaining in C#
- What represents a double in sql server?
- How do you get the index of the current iteration of a foreach loop?
- Expression denotes a `type’, where a `variable’, `value’ or `method group’ was expected UNITY3D
- How do I restart my C# WinForm Application?
- An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode
- How to split() a delimited string to a List
- “A project with an Output type of Class Library cannot be started directly”
- Creating a comma separated list from IList
or IEnumerable - Remove element of a regular array
- C# Passing Function as Argument
- “Invalid JSON primitive” in Ajax processing
- I got error “The DELETE statement conflicted with the REFERENCE constraint”
- Non-invocable member cannot be used like a method?
- How can I know if a process is running?
- understanding private setters
- c# identifier expected?
- Root element is missing
- Unable to copy file – access to the path is denied
- How to convert UTF-8 byte[] to string
- Socket.Select returns error “An operation was attempted on something that is not a socket”
- Get dictionary key by value
- Convert from List into IEnumerable format
- How do I exit from a function?
- Using OpenGl with C#? [closed]
- Equivalent of typedef in C#
- Produce a random number in a range using C#
- How do I concatenate two arrays in C#?
- Why am I getting ‘Assembly ‘*.dll’ must be strong signed in order to be marked as a prerequisite.’?
- Which passwordchar shows a black dot (•) in a winforms textbox?
- Draw Rectangle in XNA using SpriteBatch
- How do I fix a .NET windows application crashing at startup with Exception code: 0xE0434352?
- c# .net change label text
- Check if a string is a palindrome
- Authorization has been denied for this request – New Web API Project
- “A namespace cannot directly contain members such as fields or methods”
- Download file of any type in Asp.Net MVC using FileResult?
- How to use __doPostBack()
- C++ performance vs. Java/C#
- At least one object must implement IComparable
- Get local IP address
- Delay function in C#
- Error: “an object reference is required for the non-static field, method or property…” [duplicate]
- Displaying DateTime picker instead of Date picker in ASP .NET MVC 5.1/HTML 5 specific
- Linq: GroupBy, Sum and Count