Regular Expressions 101

Community Patterns

Keyboard key parser

1

Regular Expression
PCRE (PHP <7.3)

/
(?![ \t])([\wœŒ&é~"#' \\t,\(\{\[\[\-\|è`\\ç\^à@\)\]=\}$£êé*µ%ù^!§\/:;\.\?âå€çþýûîô¶ÂøʱæðÛÎÔ¹«»©®ß¬¿×÷¡²³“´]+|\+)(?<![ \t])([ \t]*\+[ \t]*)?
/
gim

Description

Parse Keyboard keys from string Like ctrl+a matches ctrl and a in one group

This supports complex strings

Submitted by Jérémy Munsch <jeremy.munsch@gmail.com> - 8 years ago