Regular Expressions 101

Community Patterns

1...34567...881

HID Usage Tables to Rust Enum

1

Regular Expression
PCRE2 (PHP >=7.3)

/
^(?'id'[0-9a-fA-F]{2})(?:-(?'id_to'\w+))? ([ \/\w-]+)(?: [\/\w]+ \d+\.\d+)?$
/
gm

Description

A regex to transform tables from https://usb.org/sites/default/files/hut1_2.pdf to rust enum items

After pasting be sure to remove the whitespaces

Submitted by dzervas - 3 months ago