🔰Examples :
python example in terminal🔴🐍 :
js example✅ :
🔰 Articles:
- Regular expressions - MDN
https://developer.mozilla.org/.../Guide/Regular_expressions
- A Step-by-Step Guide for Learning Regular Expressions: A Guide with Real-Life Usage
https://blogs.princegupta.me/a-step-by-step-guide-for...
- Regular Expressions Info
https://www.regular-expressions.info
- RegExOne
https://regexone.com
- RegEx Tutorial - java T point
https://www.javatpoint.com/regex
- RegExr learn ,build & test regEX
https://regexr.com/
- AI-Powered Regular Expression Solver
https://regex.ai/
-----
🔰 Videos:
- Regular Expressions (RegEx) Tutorial
https://youtube.com/playlist...
- Learn Regular Expressions (Regex) - Crash Course for Beginners
https://youtu.be/ZfQFUJhPqMM
- Regular Expression Tutorial - Arabic
https://youtube.com/playlist...
- Regular Expressions (Regex) Tutorial: How to Match Any Pattern of Text
https://youtu.be/sa-TUpSx1JA
- Complete Regular Expressions Tutorial! (with exercises for practice)
https://youtu.be/vsa9GGzMFXQ
- CS50P - Lecture 7 - Regular Expressions
https://youtu.be/hy3sd9MOAcc
--------
#regEx #regExp #RegulerExpression #pattern #regEx_tutorial #python_regEx #js_regEX
python example in terminal🔴🐍 :
# Test under the Python Command-Line Interpreter
$ python3
......
>>> import re # Need module 're' for regular expression
# Try find: re.findall(regexStr, inStr) -> matchedSubstringsList
# r'...' denotes raw strings which ignore escape code, i.e., r'\n' is '\'+'n'
>>> re.findall(r'[0-9]+', 'abc123xyz')
['123'] # Return a list of matched substrings
>>> re.findall(r'[0-9]+', 'abcxyz')
[]
>>> re.findall(r'[0-9]+', 'abc00123xyz456_0')
['00123', '456', '0']
>>> re.findall(r'\d+', 'abc00123xyz456_0')
['00123', '456', '0']
# Try substitute: re.sub(regexStr, replacementStr, inStr) -> outStr
>>> re.sub(r'[0-9]+', r'*', 'abc00123xyz456_0')
'abc*xyz*_*'
# Try substitute with count: re.subn(regexStr, replacementStr, inStr) -> (outStr, count)
>>> re.subn(r'[0-9]+', r'*', 'abc00123xyz456_0')
('abc*xyz*_*', 3) # Return a tuple of output string and count
js example✅ :
<!DOCTYPE html>
<!-- JSRegexNumbers.html -->
<html lang="en">
<head>
<meta charset="utf-8">
<title>JavaScript Example: Regex</title>
<script>
var inStr = "abc123xyz456_7_00";
// Use RegExp.test(inStr) to check if inStr contains the pattern
console.log(/[0-9]+/.test(inStr)); // true
// Use String.search(regex) to check if the string contains the pattern
// Returns the start position of the matched substring or -1 if there is no match
console.log(inStr.search(/[0-9]+/)); // 3
// Use String.match() or RegExp.exec() to find the matched substring,
// back references, and string index
console.log(inStr.match(/[0-9]+/)); // ["123", input:"abc123xyz456_7_00", index:3, length:"1"]
console.log(/[0-9]+/.exec(inStr)); // ["123", input:"abc123xyz456_7_00", index:3, length:"1"]
// With g (global) option
console.log(inStr.match(/[0-9]+/g)); // ["123", "456", "7", "00", length:4]
// RegExp.exec() with g flag can be issued repeatedly.
// Search resumes after the last-found position (maintained in property RegExp.lastIndex).
var pattern = /[0-9]+/g;
var result;
while (result = pattern.exec(inStr)) {
console.log(result);
console.log(pattern.lastIndex);
// ["123"], 6
// ["456"], 12
// ["7"], 14
// ["00"], 17
}
// String.replace(regex, replacement):
console.log(inStr.replace(/\d+/, "**")); // abc**xyz456_7_00
console.log(inStr.replace(/\d+/g, "**")); // abc**xyz**_**_**
</script>
</head>
<body>
<h1>Hello,</h1>
</body>
</html>
🔰 Articles:
- Regular expressions - MDN
https://developer.mozilla.org/.../Guide/Regular_expressions
- A Step-by-Step Guide for Learning Regular Expressions: A Guide with Real-Life Usage
https://blogs.princegupta.me/a-step-by-step-guide-for...
- Regular Expressions Info
https://www.regular-expressions.info
- RegExOne
https://regexone.com
- RegEx Tutorial - java T point
https://www.javatpoint.com/regex
- RegExr learn ,build & test regEX
https://regexr.com/
- AI-Powered Regular Expression Solver
https://regex.ai/
-----
🔰 Videos:
- Regular Expressions (RegEx) Tutorial
https://youtube.com/playlist...
- Learn Regular Expressions (Regex) - Crash Course for Beginners
https://youtu.be/ZfQFUJhPqMM
- Regular Expression Tutorial - Arabic
https://youtube.com/playlist...
- Regular Expressions (Regex) Tutorial: How to Match Any Pattern of Text
https://youtu.be/sa-TUpSx1JA
- Complete Regular Expressions Tutorial! (with exercises for practice)
https://youtu.be/vsa9GGzMFXQ
- CS50P - Lecture 7 - Regular Expressions
https://youtu.be/hy3sd9MOAcc
--------
#regEx #regExp #RegulerExpression #pattern #regEx_tutorial #python_regEx #js_regEX
www.regular-expressions.info
Regular-Expressions.info - Regex Tutorial, Examples and Reference - Regexp Patterns
At Regular-Expressions.info you will find a wide range of in-depth information about a powerful search pattern language called regular expressions.
🔥2👎1