Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

regex special characters to escape

Char Description	                     Meaning
	 Backslash	                         Used to escape a special character
^	 Caret	                             Beginning of a string
$	 Dollar sign	                     End of a string
.	 Period or dot	                     Matches any single character
|	 Vertical bar or pipe symbol         Matches previous OR next character/group
?	 Question mark	                     Match zero or one of the previous
*	 Asterisk or star	                 Match zero, one or more of the previous
+	 Plus sign	                         Match one or more of the previous
( )	 Opening and closing parenthesis     Group characters
[ ]	 Opening and closing square bracket	 Matches a range of characters
{ }	 Opening and closing curly brace	 Matches a specified number of occurrences of the previous
Comment

regex to escape special characters

function escapeRegExp(text) {
  return text.replace(/[-[]{}()*+?.,^$|#s]/g, '$&');
}
Comment

regular expression escape character

regex = / a/; // match a bell or alarm
regex = / e/; // matches an escape
regex = / f/; // matches a form feed
regex = / n/; // matches a new line
regex = / Q…E/; // ingnores any special meanings in what is being matched
regex = / r/; // matches a carriage return
regex = / v/; // matches a vertical tab
Comment

PREVIOUS NEXT
Code Example
Javascript :: Mongoose filter by multiple fields 
Javascript :: javascript dataset 
Javascript :: initialize a map js 
Javascript :: js for of 
Javascript :: javascript how to deal with %20 in string 
Javascript :: mongoose where 
Javascript :: sort JavaScript array by two numeric fields 
Javascript :: expo modal 
Javascript :: subtrair datas javascript frontend 
Javascript :: make a bot send a welcome message discordjs 
Javascript :: used to retrieve dat from firebase realtime datastore 
Javascript :: buildpack for nodejs 
Javascript :: javascript map to object 
Javascript :: catch errors async await javascript 
Javascript :: getJSON how to set async to false 
Javascript :: remove javascript 
Javascript :: react native tab navigation header 
Javascript :: force delete and restore in sequelize 
Javascript :: using express js response render parameter in ejs script tag as a variable in node js 
Javascript :: add val in data-id jquery 
Javascript :: setinterval vs settimeout 
Javascript :: Mongoose and multiple database in single node.js project 
Javascript :: dummy data json 
Javascript :: how to check electron verion 
Javascript :: get list of text from div in js 
Javascript :: cypress visible 
Javascript :: how to write a variable in js 
Javascript :: react native generate stylesheet with function 
Javascript :: add an object to index 0 array js 
Javascript :: distinguishing positive numbers in javascript 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =