Regex Replace Online Tool

Regular Expression

Flags(Part 1)

Flags(Part 2)


Replace To


About Regex Replace Online Tool:

This online Regex Replace tool helps you to replace string using regular expression (Javascript RegExp).

cartoon text editor

Most Common Used Regular Expression:

Email Address: ^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$

Internet URL: [a-zA-z]+://[^\s]*

Chinese Character: [\u4e00-\u9fa5]

Password (starting with a letter, length between 6 and 18, can only contain letters, numbers and underscores): ^[a-zA-Z]\w{5,17}$

Does Regex Replace Online Tool log my data?

Absolutely NOT, this Regex Replacer doing all the formatting work on the client side, all logic are implemented by Javascript. There are 2 major advantages: 1.Your data never transmitted in the Open Internet, so you know it's secure; 2.It's much faster than doing all the work in the server side, because there is no Internet Delay.

More information:

Javascript RegExp CheatSheet: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp

Python re Library: https://docs.python.org/3/library/re.html

Wikipedia (Regular Expression): https://en.wikipedia.org/wiki/Regular_expression

Replace regular expression matches in a string using Javascript:

var regex_replacer = /test/gi;
var test_string = "This is a Test string.";
var replace_to_str = "Result";
var result = test_string.replace(regex_replacer,replace_to_str,test_string);
console.log(result)

-------------------
> "this is a Result string."

Replace regular expression matches in a string using Python:

import re

regex_replacer = re.compile("test", re.IGNORECASE)
test_string = "This is a Test string."
replace_to = "result"
result = regex_replacer.sub(replace_to, test_string)
print(result)