-1

I would like to construct a regular expression with following requirements:

  • Firstly, there are a 'CTRL' or 'ALT' string.
  • Then, it is followed by a '+'.
  • Finally, there must be an alphanumeric character.

For Example:

'CTRL+a', 'ALT+B', 'ctrl+1', 'alt+3'.

Thank so much.

mgp1994
  • 19
  • 4

1 Answers1

0

This answers your request:

/(?:ctrl|alt)\+\w+/i

Demo & explanation

Toto
  • 83,193
  • 59
  • 77
  • 109