-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
  • 59
  • 1
  • 7

1 Answers1

0

This answers your request:

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

Demo & explanation

Toto
  • 89,455
  • 62
  • 89
  • 125