Community Patterns

0

Test with Regex

Created·2023-03-07 20:17
Updated·2025-12-18 05:34
Flavor·PCRE2 (PHP)
1. Type = xhr Response Headers access-control-allow-headers DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range,X-DEVICE-TOKEN,deviceToken,agent access-control-allow-methods access-control-allow-origin access-control-expose-headers access-control-max-age = 1728000 content-encoding = gzip content-type = application/json; charset = utf-8 date = Sat, 11 Feb 2023 04:29:06 GMT etag = W/"73d-UJDAIM5iwCpHWdETiOapCk02sEI" server = APISIX/2.13.0 strict-transport-security max-age=31536000; includeSubdomains; vary Accept-Encoding x-powered-by Express Request Headers Accept application/json, text/plain, / Response = { "result": 0, "message": "Success", "data": { "contracts": {"router": { "ETH": "0xb45A2DDA996C32E93B8c47098E90Ed0E7ab18E39", "HECO": "0xb45A2DDA996C32E93B8c47098E90Ed0E7ab18E39", "BSC": "0xb45A2DDA996C32E93B8c47098E90Ed0E7ab18E39", "MATIC": "0xb45A2DDA996C32E93B8c47098E90Ed0E7ab18E39", "TRON": "TKqQ7zuL7yKp1NWuhGpoXTDiE3j2qiAbRE", "FTM": "0xb45A2DDA996C32E93B8c47098E90Ed0E7ab18E39", "OEC": "0xb45A2DDA996C32E93B8c47098E90Ed0E7ab18E39", "ARB": "0xb45A2DDA996C32E93B8c47098E90Ed0E7ab18E39", "KLAY": "0x9865EeBdD1cE65f45b6247AEEd2fA2252ECA7A08", "AVAX": "0xb45A2DDA996C32E93B8c47098E90Ed0E7ab18E39", "KCC": "0xb45A2DDA996C32E93B8c47098E90Ed0E7ab18E39", "CFX": "0xb45A2DDA996C32E93B8c47098E90Ed0E7ab18E39", "GLMR": "0xb45A2DDA996C32E93B8c47098E90Ed0E7ab18E39", "OP": "0xb45A2DDA996C32E93B8c47098E90Ed0E7ab18E39", "ETC": "0xb45A2DDA996C32E93B8c47098E90Ed0E7ab18E39" }, "approve": { "ETH": "0xb45A2DDA996C32E93B8c47098E90Ed0E7ab18E39", "HECO": "0xb45A2DDA996C32E93B8c47098E90Ed0E7ab18E39", "BSC": "0xb45A2DDA996C32E93B8c47098E90Ed0E7ab18E39", "MATIC": "0xb45A2DDA996C32E93B8c47098E90Ed0E7ab18E39", "TRON": "TKqQ7zuL7yKp1NWuhGpoXTDiE3j2qiAbRE", "FTM": "0xb45A2DDA996C32E93B8c47098E90Ed0E7ab18E39",
Submitted by Yetaroo
0

Get path from any text

Created·2023-01-31 14:39
Updated·2023-05-04 12:23
Flavor·PCRE2 (PHP)
Get path (windows style) from any type of text (error message, e-mail corps ...), quoted or not. THIS IS COMMENTED VERSION ! to simple copy and use it, go https://regex101.com/r/zWGLMP Relative path are not supported The goal is to catch what "Look like" a path. See the limitations UNC path and prefix path like //./], [//?/] or [//./UNC/] are allowed some url path like [file:///C:/] or [file://] are allowed Catch path quoted with ["] and [']. But these quotes are include with the catch Quoted path is not concerned by limitations Limitations : (only unquoted path) [dot] and [space] is allowed, but not in a row [dot+space] or [space+dot at end of file name isn't catched INSIDE A NAME FILE (or last directory if it is a path to a directory) : [comma] is not supported (it stop the catch) after a first [dot], any [space] stop the catch after a [space], catch is stoped if next character is not a [letter], [digit] or [-] so, double [space] stop the catch Compatibility compatible PCRE, PCRE2 AutoHotkey : don't forget to escape "%" in "`%" /!\ Powershell and .Net /!\\ : this regex need some modification to be interpreted by powershell. You have to replace each (?&CapturGroupName) by \k. Use this powershell code to do this replacement : ` $powershellRegex = @' [Put here the regex to replace (?&CapturGroupName) with \k] '@ -replace '\(\?&(\w+)\)', '\k' ` This example code must return : [Put here the regex to replace \k with \k]
Submitted by nitrateag

Community Library Entry

16

Regular Expression
Created·2015-06-21 19:49
Flavor·ECMAScript (JavaScript)

/
^((https?:)(\/\/\/?)([\w]*(?::[\w]*)?@)?([\d\w\.-]+)(?::(\d+))?)?([\/\\\w\.()-]*)?(?:([?][^#]*)?(#.*)?)*
/
gmi
Open regex in editor

Description

general purpose HTTP URL regex

Submitted by Miguel Castillo @manchagnu