v2
  • LFX Toolkit
  • Release Notes
  • EasyCLA
    • Releases and Known Issues
    • Getting Started
      • Prerequisites
      • EasyCLA Troubleshooting
        • EasyCLA is Disabled
      • EasyCLA FAQs
      • EasyCLA Development Components
    • Project Managers
      • Set up project on EasyCLA
      • Sign in to Project Control Center
      • Create New CLA Group
      • Update Templates
      • Add or Remove a Project from CLA Group
      • View and Manage CLA Group Details
      • Add and Manage GitHub Organizations
      • Add and Manage Gerrit Organizations
      • Add and Manage GitLab Groups
      • View Connection Status of Git Organizations and Repositories
      • Enforce or Remove CLA Mechanism
      • Invalidate a Contributor's Signature
      • Uninstall the EasyCLA Application
    • Contributors
      • Individual Contributor
      • Corporate Contributor
    • Corporate CLA Managers
      • Sign In to the EasyCLA Corporate Console
      • Coordinate Signing CCLA and become initial CLA Manager
      • Add or Delete CLA Managers
      • Approve and Manage Contributors
    • CCLA Signatories
      • Review and Sign a Corporate CLA by Request
    • Glossary
  • Corporate CLA Console
    • Dashboard
    • Projects
      • Sign CLA for a Project
      • Add or Delete a CLA Manager
      • Add and Manage a Contributor
    • Manage Organization
    • Manage your Profile
  • Security Service
    • GitHub Onboarding
    • Manage Vulnerabilities
    • Manage False Positives
      • Regular Expressions Cheat Sheet
    • Manage Non Inclusive Naming
  • Project Control Center (PCC) - Pre Release
    • Overview
    • Adding a Main Project
    • Setup Services for a Project
    • IT Services for a Project
    • EasyCLA Service
    • PCC Dashboard
    • Security Service
    • Cloud Providers
    • Enabling Email Forwarding
    • Setting up a Domain for a Project
    • Source Control
    • Issue Tracking for a Project
    • Mailing List
    • Setting up Wiki
    • Meetings
  • Organization Dashboard - Pre Release
    • Overview
    • Global Statistics
    • Projects
    • My Organization
    • Organization Profile
    • Managing Teams
    • Global Events
    • Global Training and Certifications
    • Resources
    • Membership Details of a Project
    • Benefits
    • Committees
    • Project Contributors
    • Meetings
    • Project Contributions
    • Member Promotions
    • Dashboard
    • Membership Summary
    • Training and Certifications
    • Events Insights
    • Global Attendee Insights
Powered by GitBook
On this page
  • Regular Expression Basics
  • Regular Expression Quantifiers
  • Regular Expression Groups
  • Regular Expression Character Classes
  • Regular Expression Assertions
  • Regular Expression Flags
  • Regular Expression Special Characters
  • Regular Expression Posix Classes
  1. Security Service
  2. Manage False Positives

Regular Expressions Cheat Sheet

A regular expression (regex or regexp) is a sequence of characters that specifies a search pattern. Usually such patterns are used by string-searching algorithms for "find" or "find and replace" operations on strings, or for input validation.

The below tables assists you on how to use different regular expressions:

Regular Expression Basics

Character

Explanation

.

Anything. Any character except newline

a

The character a

ab

The string ab

a|b

a or b

a*

0 or more a's

\

Escapes a special character

Regular Expression Quantifiers

Character

Explanation

*

0 or more

+

1 or more

?

0 or 1

{2}

Exactly 2

{2, 5}

Between 2 and 5

{2,}

2 or more

Regular Expression Groups

Character

Explanation

(...)

Capturing group

(?P<Y>...)

Capturing group named Y

(?:...)

Non-capturing group

(?>...)

Atomic group

(?|...)

Duplicate group numbers

\Y

Match the Y'th captured group

(?P=Y)

Match the named group Y

(?R)

Recurse into entire pattern

(?Y)

Recurse into numbered group Y

(?&Y)

Recurse into named group Y

\g{Y}

Match the named or numbered group Y

\g<Y>

Recurse into named or numbered group Y

(?#...)

Comment

Regular Expression Character Classes

Character

Explanation

[ab-d]

One character of: a, b, c, d

[^ab-d]

One character except: a, b, c, d

[\b]

Backspace character

\d

One digit

\D

One non-digit

\s

One whitespace

\S

One non-whitespace

\w

One word character

\W

One non-word character

Regular Expression Assertions

Character

Explanation

^

Start of string

\A

Start of string, ignores m flag

$

End of string

\Z

End of string, ignores m flag

\b

Word boundary

\B

Non-word boundary

\G

Start of match

(?=...)

Positive lookahead

(?!...)

Negative lookahead

(?<=...)

Positive lookbehind

(?<!...)

Negative lookbehind

(?()|)

Conditional

Regular Expression Flags

Character

Explanation

i

Ignore case

m

^ and $ match start and end of line

s

. matches newline as well

x

Allow spaces and comments

J

Duplicate group names allowed

U

Ungreedy quantifiers

(?iLmsux)

Set flags within regex

Regular Expression Special Characters

Character

Explanation

\n

Newline

\r

Carriage return

\t

Tab

\0

Null character

\YYY

Octal character YYY

\xYY

Hexadecimal character YY

\x{YY}

Hexadecimeal character YY

\cY

Control character Y

Regular Expression Posix Classes

Character

Explanation

[:alnum:]

Letters and digits

[:alpha:]

Letters

[:ascii:]

Ascii codes 0 - 127

[:blank:]

Space or tab only

[:cntrl:]

Control characters

[:digit:]

Decimal digits

[:graph:]

Visible characters, except space

[:lower:]

Lowercase letters

[:print:]

Visible characters

[:punct:]

Visible punctuation characters

[:space:]

Whitespace

[:upper:]

Uppercase letters

[:word:]

Word characters

[:xdigit:]

Hexadecimal digits

PreviousManage False PositivesNextManage Non Inclusive Naming

Last updated 3 years ago