-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
  • 51
  • 5

1 Answers1

0

This answers your request:

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

Demo & explanation

Toto
  • 86,179
  • 61
  • 85
  • 118