Regular Expressions 101

Sponsors

Library entries

1
pcre2

Email Extractor

([a-zA-Z0-9.-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9_-]+)
Submitted by Kashif - a year ago
1
pcre2

Pattern string

Example of test I did do to company.
Submitted by Claudio Santos - a year ago
1
golang

lsblk-output-regex

Trying to adapt this regex to support LVM.
Submitted by anonymous - a year ago
1
pcre2

BIC Codes

BIC (Bank Identifier Code) #fin #bank #swift #iban #bic
Submitted by anonymous - a year ago
1
pcre2

Detect any integer larger than 499

Glad this helps for some
Submitted by Wallik - a year ago

Get path from any text

Vote

5

Regular Expression
pcre2

/
((?:(?# path without "" )(?<opening>(?# 'C:/', '//', '//./<UNC/C:>', '//?/<UNC/C:>' or '%VariableWindows%')(?<UNCPrefix>[\/\\][\/\\][?.][\/\\](?:UNC[\/\\])?)?(?<montage>\b[a-zA-Z]:[\/\\])|(?:(?:(?&UNCPrefix))|(?:[\/\\][\/\\](?!(?&montage))))|(?:%\w+%[\/\\]?))(?:(?# directory btw // )[^\/\\<>:"|?\n\r ][^\/\\<>:"|?\n\r]*(?<![ ])[\/\\])*(?:(?#we search for fileName only if next character is pathFriendly)(?=[^\/\\<>:"'|?\n\r;, ])(?:(?#name file ? dir ?)(?:[^\/\\<>:"|?\n\r;, .](?: (?=\w))?(?:\*(?!= ))?(?!(?&montage)))+)?(?:(?#extention)\.\w+)*))|(?:(?# path quoted "" or '' )["'](?&opening)(?=.*?["'])(?:[^\/\\<>:'"|?\n\r]+[\/\\]?)+?["']))
/
g

Description

Loading markdown...
Submitted by nitrateag - 2 months ago