Regular Expressions 101

Community Patterns

x86 ASM Register [Case-Insensitive]

1

Regular Expression
PCRE2 (PHP >=7.3)

/
\b(?:[eErR])?(?:(?:[aAbBcCdD][xX])|(?:[iI][pP])|[PeErR]?(?:[sSbB][pP]|[SsdD][iI]))\b|\b(?:[sSbB][pP]|[sSdD][iI])[lL]?\b|\b[aAbBcCdD][hHlL]\b|\b[mM][sS][wW]\b|\b[mM][xX][cC][sS][rR]\b|\b(?:[rR](?:1[0-5]|[0-9])[wWdDbB])\b|\b(?:[cCdD]?[rR](?:1[0-5]|[0-9]))\b|\b[cCsStT][wW]\b|\b[cCsSdDeEfFgG][sS]\b|\b[fF][pP]_(?:[iIdD][pP]|[cCdD][sS]|[oO][pP][cC])\b|\b(?:[gGiIlL][dD])?[tT][rR]\b|\b(?:[eErR])?[fF][lL][aA][gG][sS]\b|\b(?:[mM][mM][0-7])\b|\b(?:[xXyY][mM][mM](?:1[0-5]|[0-9]))\b|\b(?:[zZ][mM][mM](?:3[0-2]|2[0-9]|1[0-9]|[0-9]))\b|(?:\b[sS][tT][0-7]\b|(?:\b[sS][tT]\b\([0-7]\)))
/
gm

Description

A RegEx to match any Intel x86-Assembly register in a case-insensitive way.

This is due to a limitation of the engine this regular expression was originally written for.

Here is an updated version that is written for Regex-Engines that support the /i flag: https://regex101.com/library/4v1bVf

Submitted by Tim Clemens - 18 days ago