/^[a-z0-9]+$/i ^ Start of string [a-z0-9] a or b or c or ... z or 0 or 1 or ... 9 + one or more times (change to * to allow empty string) $ end of string /i case-insensitive
Update (supporting universal characters)
if you need to this regexp supports universal character you can find list of unicode characters here.
for example: /^([a-zA-Z0-9\u0600-\u06FF\u0660-\u0669\u06F0-\u06F9 _.-]+)$/
this will support persian.
Related Posts:
- Javascript split regex question
- What is a good regular expression to match a URL? [duplicate]
- What is a good regular expression to match a URL? [duplicate]
- Is there a difference between /\s/g and /\s+/g?
- RegEx Ignore Case
- JavaScript replace/regex
- Regex for password must contain at least eight characters, at least one number and both lower and uppercase letters and special characters
- Escaping Discord subset of markdown
- How to test valid UUID/GUID?
- Regular expression : match either of two conditions?
- RegExp in TypeScript
- Converting any string into camel case
- I want to remove double quotes from a String
- Regular expression for removing whitespaces
- Javascript Regular Expression Remove Spaces
- How can I extract a number from a string in JavaScript?
- Remove not alphanumeric characters from string
- Extract hostname name from string
- Difference between ?:, ?! and ?=
- Remove all special characters with RegExp
- How do you use a variable in a regular expression?
- How to count string occurrence in string?
- Regular Expression to reformat a US phone number in Javascript
- Jquery Value match Regex
- RegEx: How can I match all numbers greater than 49?
- Regular expression to validate US phone numbers?
- javascript includes() case insensitive
- Check user logged in with JS
- Cannot set property InnerHTML of null [duplicate]
- How can I submit a form using JavaScript?
- How do I get the current date in JavaScript?
- How to do a redirect to another route with react-router?
- Jest spy on functionality
- Use a JSON array with objects with javascript
- JavaScript string newline character?
- How to create a GUID / UUID
- How does “/\s/g” replace spaces with other characters?
- What is the correct way to check for string equality in JavaScript?
- JavaScript TypeError: Cannot read property ‘style’ of null
- How to obtain username from Promise
? - How do you check if a variable is an array in JavaScript?
- Static variables in JavaScript
- ReferenceError : window is not defined at object.
Node.js - Node.js Port 3000 already in use but it actually isn’t?
- Uncaught TypeError: $.post is not a function
- Unable to verify leaf signature
- When and why to ‘return false’ in JavaScript?
- Possible to extend types in Typescript?
- JavaScript enumerator?
- How to format numbers as currency strings
- Understanding how data-dismiss attribute works in Bootstrap
- Add table row in jQuery
- Node.js document is not defined
- Create table with jQuery – append
- How to download a file with Node.js (without using third-party libraries)?
- Getting current date and time in JavaScript
- What is ViewChild in Angular2?
- Permutations in JavaScript?
- How do I remove documents using Node.js Mongoose?
- node-request – Getting error “SSL23_GET_SERVER_HELLO:unknown protocol”
- Mixed Content Page: requested an insecure stylesheet error
- How to do integer division in javascript (Getting division answer in int not float)?
- javascript unexpected identifier
- How to send email by using javascript or jquery
- Access to Image from origin ‘null’ has been blocked by CORS policy
- Onclick on bootstrap button
- TypeError: res.json is not a function
- JavaScript post request like a form submit
- Jest encountered an unexpected token
- Using “×” word in html changes to ×
- How do I store an array in localStorage?
- How to check if the URL contains a given string?
- How to enable CORS in AngularJs
- bootstrap buttons onclick events
- is it posible to add anime.js in WordPress
- What type of template are WP media-modal’s templates?
- Eliminate render blocking javascript
- is_front_page() not working
- The value of attribute [ data-type ] must be in double quotes – custom html widget error
- Add tinymce dynamically via Javascript
- Sending custom data with Media Frame Model
- Make TinyMCE checkbox that returns a value instead of true/false
- Adding JavaScript to a WordPress website
- wp-env mysqlcheck error:1130
- How to disable inline css styles generated by Gutenberg editor?
- Multiple Conditional Controllers
- Adding javascript trigger to user role selection on the user-edit page
- Vue and wordpress.Bad Request ajax request
- How to add if lt IE9 conditional scripts to functions.php
- How to include a JSON file on my page?
- Adding inline JavaScript after wp_enqueue_scripts
- How to add “on change” to a text input in contact form7?
- Update media library attachments
- JavaScript Libraries in WordPress
- How to use WP switchEditors.switchto(this) JS function in your own script?
- Landing function through URL
- Escaping quotes while enqueuing scripts
- Combining results from WP-API using AngularJS
- Anyway to disable the auto excerpt creation?
- How do I cycle a JS function in WordPress? [closed]