•  Home
  •  Dashboard
  •  Company
    • About Us
    • Blog
    • Careers
    • Contact Us
    • Data Centers
    • Looking Glass
    • Network
    • Reseller
  •  Hosting Services
    • Backup
    • Content Delivery Network
    • Colocation Hosting
    • Dedicated Hosting
    • DDoS Mitigation
    • IP Transit
    • Private Cloud
    • Wavelength
  •  Solutions
    • Ecommerce
    • Finance
    • Gaming
    • Hosting
    • Management
    • Security
    • System Integrator
  •  Support
    • Community
    • Knowledge Base
    • Open A Ticket
  •  USA & Canada: 800-933-1517
  •  International: 626-549-2801
  •  Email: sales@psychz.net
  • Services
    • Dedicated Servers
    • Colocation
    • Private Cloud
    • DDos Protection
    • IP Transit
    • CDN
    • Backup
  • Solutions
    • Ecommerce
    • Security
    • Gaming
    • Hosting
    • Management
    • Finance
    • System Integrator
  • Dashboard

Regex: regular expression cheat sheet

  • Home
  • Client
  • Knowledgebase
  • Devices
  • CDN
  • Regex: regular expression cheat sheet

Table Of Content

Related Articles

  • Create CDN Domain
  • Manage CDN Domain
  • Manage CDN Services
  • CDN Intro
  • How to move existing domain from one CDN device to another
  • IP's for Psychz Networks CDN edge servers
  • Order CDN Service
  • Complete Guide To Psychz's CDN
  • Reading real IPs
  • Views: (5474)
  • Votes: (1)
Was this article helpful?
VOTE

Regex: regular expression cheat sheet

Publisher: Psychz Networks,  August 23,2018

"REGEX" abbreviation for Regular expressions are highly useful in extracting information from any text by using a particular search pattern (ASCII or Unicode characters) for one or more matches.

Regex is used in many applications ranging from web scraping, translating data to other formats, validation to parsing/replacing strings.

This tool is compatible with almost all the programming languages including JavaScript, Java, VB, C #, C / C++, Python, and many others).

Anchors — ^ and $

 ^

 This symbol indicates start of a string

 $

This symbol indicates end of a string

Quantifiers — * + ? and {}

The symbols '*', '+', and '?', denote the number of times a character or a sequence of characters may occur. What they mean is: "zero or more", "one or more", and "zero or one."
You can also use bounds, which appear inside braces {} and indicate ranges in the number of occurrences:

 *

 Matches 0 or more of the previous character (e.g. ab*c  will generate output as “ac”, “abc”, “abbc”, etc.

 ?

 Matches 0 or 1 of the previous character

 +

 Matches 1 or more of the previous character

 {x}

 Matches exactly x number of times

 {x, y}

 Matches everything between x, y characters

OR operator — | or []

 |

 Matches a character or group of characters on either side (e.g. a|b corresponds to a or b)

[]

This works exactly as previous

Character classes — \d \w \s and .

\d

 Matches one digit

\D

Performs inverse matches of \d

\w

 Matches a word character

\W

Performs inverse matches of \w

\s

 Matches a whitespace character

\S

Performs inverse matches of \s

 .

Matches any character*. Hence called a  Wildcard  ; *except newline (/n).

 

 

Hosting Services
  • Dedicated Hosting
  • Colocation Hosting
  • Backup
  • IP Transit
  • DDoS Mitigation
Support
  • Portal Login
  • Knowledgebase
  • Community
Company
  • About Us
  • Contact Us
  • Network
  • Data Centers
  • Looking Glass
  • Affiliates
  • Reseller
  • Blog
Policies
  • Privacy Policy
  • Acceptable Usage Policy
  • Terms and Conditions
  • Service Level Agreement
Company
  • Psychz Networks,
    A Profuse Solutions Company
    611 Wilshire Blvd #300
    Los Angeles,California 90017
    USA
  • US/Canada: 800-933-1517
  • International: 626-549-2801
Subscribe to Our Mailing List
* indicates required
Copyright © 2023 Psychz Networks, A Profuse Solutions Inc Company