Regular Expressions 101

Save & Share

  • Regex Version: ver. 1
  • Update Regex
    ctrl+⇧+s
  • Save new Regex
    ctrl+s
  • Add to Community Library

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8
  • .NET 7.0 (C#)
  • Rust
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests

Tools

Sponsors
There are currently no sponsors. Become a sponsor today!
An explanation of your regex will be automatically generated as you type.
Detailed match information will be displayed here automatically.
  • All Tokens
  • Common Tokens
  • General Tokens
  • Anchors
  • Meta Sequences
  • Quantifiers
  • Group Constructs
  • Character Classes
  • Flags/Modifiers
  • Substitution
  • A single character of: a, b or c
    [abc]
  • A character except: a, b or c
    [^abc]
  • A character in the range: a-z
    [a-z]
  • A character not in the range: a-z
    [^a-z]
  • A character in the range: a-z or A-Z
    [a-zA-Z]
  • Any single character
    .
  • Alternate - match either a or b
    a|b
  • Any whitespace character
    \s
  • Any non-whitespace character
    \S
  • Any digit
    \d
  • Any non-digit
    \D
  • Any word character
    \w
  • Any non-word character
    \W
  • Non-capturing group
    (?:...)
  • Capturing group
    (...)
  • Zero or one of a
    a?
  • Zero or more of a
    a*
  • One or more of a
    a+
  • Exactly 3 of a
    a{3}
  • 3 or more of a
    a{3,}
  • Between 3 and 6 of a
    a{3,6}
  • Start of string
    ^
  • End of string
    $
  • A word boundary
    \b
  • Non-word boundary
    \B

Regular Expression

/
/
gm

Test String

Substitution

Processing...

Code Generator

Generated Code

import java.util.regex.Matcher; import java.util.regex.Pattern; public class Example { public static void main(String[] args) { final String regex = "(?<=public static final int ).+(?=;)"; final String string = "/** Key code constant: Unknown key code. */\n" + " public static final int KEYCODE_UNKNOWN = 0;\n" + " /** Key code constant: Soft Left key.\n" + " * Usually situated below the display on phones and used as a multi-function\n" + " * feature key for selecting a software defined function shown on the bottom left\n" + " * of the display. */\n" + " public static final int KEYCODE_SOFT_LEFT = 1;\n" + " /** Key code constant: Soft Right key.\n" + " * Usually situated below the display on phones and used as a multi-function\n" + " * feature key for selecting a software defined function shown on the bottom right\n" + " * of the display. */\n" + " public static final int KEYCODE_SOFT_RIGHT = 2;\n" + " /** Key code constant: Home key.\n" + " * This key is handled by the framework and is never delivered to applications. */\n" + " public static final int KEYCODE_HOME = 3;\n" + " /** Key code constant: Back key. */\n" + " public static final int KEYCODE_BACK = 4;\n" + " /** Key code constant: Call key. */\n" + " public static final int KEYCODE_CALL = 5;\n" + " /** Key code constant: End Call key. */\n" + " public static final int KEYCODE_ENDCALL = 6;\n" + " /** Key code constant: '0' key. */\n" + " public static final int KEYCODE_0 = 7;\n" + " /** Key code constant: '1' key. */\n" + " public static final int KEYCODE_1 = 8;\n" + " /** Key code constant: '2' key. */\n" + " public static final int KEYCODE_2 = 9;\n" + " /** Key code constant: '3' key. */\n" + " public static final int KEYCODE_3 = 10;\n" + " /** Key code constant: '4' key. */\n" + " public static final int KEYCODE_4 = 11;\n" + " /** Key code constant: '5' key. */\n" + " public static final int KEYCODE_5 = 12;\n" + " /** Key code constant: '6' key. */\n" + " public static final int KEYCODE_6 = 13;\n" + " /** Key code constant: '7' key. */\n" + " public static final int KEYCODE_7 = 14;\n" + " /** Key code constant: '8' key. */\n" + " public static final int KEYCODE_8 = 15;\n" + " /** Key code constant: '9' key. */\n" + " public static final int KEYCODE_9 = 16;\n" + " /** Key code constant: '*' key. */\n" + " public static final int KEYCODE_STAR = 17;\n" + " /** Key code constant: '#' key. */\n" + " public static final int KEYCODE_POUND = 18;\n" + " /** Key code constant: Directional Pad Up key.\n" + " * May also be synthesized from trackball motions. */\n" + " public static final int KEYCODE_DPAD_UP = 19;\n" + " /** Key code constant: Directional Pad Down key.\n" + " * May also be synthesized from trackball motions. */\n" + " public static final int KEYCODE_DPAD_DOWN = 20;\n" + " /** Key code constant: Directional Pad Left key.\n" + " * May also be synthesized from trackball motions. */\n" + " public static final int KEYCODE_DPAD_LEFT = 21;\n" + " /** Key code constant: Directional Pad Right key.\n" + " * May also be synthesized from trackball motions. */\n" + " public static final int KEYCODE_DPAD_RIGHT = 22;\n" + " /** Key code constant: Directional Pad Center key.\n" + " * May also be synthesized from trackball motions. */\n" + " public static final int KEYCODE_DPAD_CENTER = 23;\n" + " /** Key code constant: Volume Up key.\n" + " * Adjusts the speaker volume up. */\n" + " public static final int KEYCODE_VOLUME_UP = 24;\n" + " /** Key code constant: Volume Down key.\n" + " * Adjusts the speaker volume down. */\n" + " public static final int KEYCODE_VOLUME_DOWN = 25;\n" + " /** Key code constant: Power key. */\n" + " public static final int KEYCODE_POWER = 26;\n" + " /** Key code constant: Camera key.\n" + " * Used to launch a camera application or take pictures. */\n" + " public static final int KEYCODE_CAMERA = 27;\n" + " /** Key code constant: Clear key. */\n" + " public static final int KEYCODE_CLEAR = 28;\n" + " /** Key code constant: 'A' key. */\n" + " public static final int KEYCODE_A = 29;\n" + " /** Key code constant: 'B' key. */\n" + " public static final int KEYCODE_B = 30;\n" + " /** Key code constant: 'C' key. */\n" + " public static final int KEYCODE_C = 31;\n" + " /** Key code constant: 'D' key. */\n" + " public static final int KEYCODE_D = 32;\n" + " /** Key code constant: 'E' key. */\n" + " public static final int KEYCODE_E = 33;\n" + " /** Key code constant: 'F' key. */\n" + " public static final int KEYCODE_F = 34;\n" + " /** Key code constant: 'G' key. */\n" + " public static final int KEYCODE_G = 35;\n" + " /** Key code constant: 'H' key. */\n" + " public static final int KEYCODE_H = 36;\n" + " /** Key code constant: 'I' key. */\n" + " public static final int KEYCODE_I = 37;\n" + " /** Key code constant: 'J' key. */\n" + " public static final int KEYCODE_J = 38;\n" + " /** Key code constant: 'K' key. */\n" + " public static final int KEYCODE_K = 39;\n" + " /** Key code constant: 'L' key. */\n" + " public static final int KEYCODE_L = 40;\n" + " /** Key code constant: 'M' key. */\n" + " public static final int KEYCODE_M = 41;\n" + " /** Key code constant: 'N' key. */\n" + " public static final int KEYCODE_N = 42;\n" + " /** Key code constant: 'O' key. */\n" + " public static final int KEYCODE_O = 43;\n" + " /** Key code constant: 'P' key. */\n" + " public static final int KEYCODE_P = 44;\n" + " /** Key code constant: 'Q' key. */\n" + " public static final int KEYCODE_Q = 45;\n" + " /** Key code constant: 'R' key. */\n" + " public static final int KEYCODE_R = 46;\n" + " /** Key code constant: 'S' key. */\n" + " public static final int KEYCODE_S = 47;\n" + " /** Key code constant: 'T' key. */\n" + " public static final int KEYCODE_T = 48;\n" + " /** Key code constant: 'U' key. */\n" + " public static final int KEYCODE_U = 49;\n" + " /** Key code constant: 'V' key. */\n" + " public static final int KEYCODE_V = 50;\n" + " /** Key code constant: 'W' key. */\n" + " public static final int KEYCODE_W = 51;\n" + " /** Key code constant: 'X' key. */\n" + " public static final int KEYCODE_X = 52;\n" + " /** Key code constant: 'Y' key. */\n" + " public static final int KEYCODE_Y = 53;\n" + " /** Key code constant: 'Z' key. */\n" + " public static final int KEYCODE_Z = 54;\n" + " /** Key code constant: ',' key. */\n" + " public static final int KEYCODE_COMMA = 55;\n" + " /** Key code constant: '.' key. */\n" + " public static final int KEYCODE_PERIOD = 56;\n" + " /** Key code constant: Left Alt modifier key. */\n" + " public static final int KEYCODE_ALT_LEFT = 57;\n" + " /** Key code constant: Right Alt modifier key. */\n" + " public static final int KEYCODE_ALT_RIGHT = 58;\n" + " /** Key code constant: Left Shift modifier key. */\n" + " public static final int KEYCODE_SHIFT_LEFT = 59;\n" + " /** Key code constant: Right Shift modifier key. */\n" + " public static final int KEYCODE_SHIFT_RIGHT = 60;\n" + " /** Key code constant: Tab key. */\n" + " public static final int KEYCODE_TAB = 61;\n" + " /** Key code constant: Space key. */\n" + " public static final int KEYCODE_SPACE = 62;\n" + " /** Key code constant: Symbol modifier key.\n" + " * Used to enter alternate symbols. */\n" + " public static final int KEYCODE_SYM = 63;\n" + " /** Key code constant: Explorer special function key.\n" + " * Used to launch a browser application. */\n" + " public static final int KEYCODE_EXPLORER = 64;\n" + " /** Key code constant: Envelope special function key.\n" + " * Used to launch a mail application. */\n" + " public static final int KEYCODE_ENVELOPE = 65;\n" + " /** Key code constant: Enter key. */\n" + " public static final int KEYCODE_ENTER = 66;\n" + " /** Key code constant: Backspace key.\n" + " * Deletes characters before the insertion point, unlike {@link #KEYCODE_FORWARD_DEL}. */\n" + " public static final int KEYCODE_DEL = 67;\n" + " /** Key code constant: '`' (backtick) key. */\n" + " public static final int KEYCODE_GRAVE = 68;\n" + " /** Key code constant: '-'. */\n" + " public static final int KEYCODE_MINUS = 69;\n" + " /** Key code constant: '=' key. */\n" + " public static final int KEYCODE_EQUALS = 70;\n" + " /** Key code constant: '[' key. */\n" + " public static final int KEYCODE_LEFT_BRACKET = 71;\n" + " /** Key code constant: ']' key. */\n" + " public static final int KEYCODE_RIGHT_BRACKET = 72;\n" + " /** Key code constant: '\\' key. */\n" + " public static final int KEYCODE_BACKSLASH = 73;\n" + " /** Key code constant: ';' key. */\n" + " public static final int KEYCODE_SEMICOLON = 74;\n" + " /** Key code constant: ''' (apostrophe) key. */\n" + " public static final int KEYCODE_APOSTROPHE = 75;\n" + " /** Key code constant: '/' key. */\n" + " public static final int KEYCODE_SLASH = 76;\n" + " /** Key code constant: '@' key. */\n" + " public static final int KEYCODE_AT = 77;\n" + " /** Key code constant: Number modifier key.\n" + " * Used to enter numeric symbols.\n" + " * This key is not Num Lock; it is more like {@link #KEYCODE_ALT_LEFT} and is\n" + " * interpreted as an ALT key by {@link android.text.method.MetaKeyKeyListener}. */\n" + " public static final int KEYCODE_NUM = 78;\n" + " /** Key code constant: Headset Hook key.\n" + " * Used to hang up calls and stop media. */\n" + " public static final int KEYCODE_HEADSETHOOK = 79;\n" + " /** Key code constant: Camera Focus key.\n" + " * Used to focus the camera. */\n" + " public static final int KEYCODE_FOCUS = 80; // *Camera* focus\n" + " /** Key code constant: '+' key. */\n" + " public static final int KEYCODE_PLUS = 81;\n" + " /** Key code constant: Menu key. */\n" + " public static final int KEYCODE_MENU = 82;\n" + " /** Key code constant: Notification key. */\n" + " public static final int KEYCODE_NOTIFICATION = 83;\n" + " /** Key code constant: Search key. */\n" + " public static final int KEYCODE_SEARCH = 84;\n" + " /** Key code constant: Play/Pause media key. */\n" + " public static final int KEYCODE_MEDIA_PLAY_PAUSE= 85;\n" + " /** Key code constant: Stop media key. */\n" + " public static final int KEYCODE_MEDIA_STOP = 86;\n" + " /** Key code constant: Play Next media key. */\n" + " public static final int KEYCODE_MEDIA_NEXT = 87;\n" + " /** Key code constant: Play Previous media key. */\n" + " public static final int KEYCODE_MEDIA_PREVIOUS = 88;\n" + " /** Key code constant: Rewind media key. */\n" + " public static final int KEYCODE_MEDIA_REWIND = 89;\n" + " /** Key code constant: Fast Forward media key. */\n" + " public static final int KEYCODE_MEDIA_FAST_FORWARD = 90;\n" + " /** Key code constant: Mute key.\n" + " * Mute key for the microphone (unlike {@link #KEYCODE_VOLUME_MUTE}, which is the speaker mute\n" + " * key). */\n" + " public static final int KEYCODE_MUTE = 91;\n" + " /** Key code constant: Page Up key. */\n" + " public static final int KEYCODE_PAGE_UP = 92;\n" + " /** Key code constant: Page Down key. */\n" + " public static final int KEYCODE_PAGE_DOWN = 93;\n" + " /** Key code constant: Picture Symbols modifier key.\n" + " * Used to switch symbol sets (Emoji, Kao-moji). */\n" + " public static final int KEYCODE_PICTSYMBOLS = 94; // switch symbol-sets (Emoji,Kao-moji)\n" + " /** Key code constant: Switch Charset modifier key.\n" + " * Used to switch character sets (Kanji, Katakana). */\n" + " public static final int KEYCODE_SWITCH_CHARSET = 95; // switch char-sets (Kanji,Katakana)\n" + " /** Key code constant: A Button key.\n" + " * On a game controller, the A button should be either the button labeled A\n" + " * or the first button on the bottom row of controller buttons. */\n" + " public static final int KEYCODE_BUTTON_A = 96;\n" + " /** Key code constant: B Button key.\n" + " * On a game controller, the B button should be either the button labeled B\n" + " * or the second button on the bottom row of controller buttons. */\n" + " public static final int KEYCODE_BUTTON_B = 97;\n" + " /** Key code constant: C Button key.\n" + " * On a game controller, the C button should be either the button labeled C\n" + " * or the third button on the bottom row of controller buttons. */\n" + " public static final int KEYCODE_BUTTON_C = 98;\n" + " /** Key code constant: X Button key.\n" + " * On a game controller, the X button should be either the button labeled X\n" + " * or the first button on the upper row of controller buttons. */\n" + " public static final int KEYCODE_BUTTON_X = 99;\n" + " /** Key code constant: Y Button key.\n" + " * On a game controller, the Y button should be either the button labeled Y\n" + " * or the second button on the upper row of controller buttons. */\n" + " public static final int KEYCODE_BUTTON_Y = 100;\n" + " /** Key code constant: Z Button key.\n" + " * On a game controller, the Z button should be either the button labeled Z\n" + " * or the third button on the upper row of controller buttons. */\n" + " public static final int KEYCODE_BUTTON_Z = 101;\n" + " /** Key code constant: L1 Button key.\n" + " * On a game controller, the L1 button should be either the button labeled L1 (or L)\n" + " * or the top left trigger button. */\n" + " public static final int KEYCODE_BUTTON_L1 = 102;\n" + " /** Key code constant: R1 Button key.\n" + " * On a game controller, the R1 button should be either the button labeled R1 (or R)\n" + " * or the top right trigger button. */\n" + " public static final int KEYCODE_BUTTON_R1 = 103;\n" + " /** Key code constant: L2 Button key.\n" + " * On a game controller, the L2 button should be either the button labeled L2\n" + " * or the bottom left trigger button. */\n" + " public static final int KEYCODE_BUTTON_L2 = 104;\n" + " /** Key code constant: R2 Button key.\n" + " * On a game controller, the R2 button should be either the button labeled R2\n" + " * or the bottom right trigger button. */\n" + " public static final int KEYCODE_BUTTON_R2 = 105;\n" + " /** Key code constant: Left Thumb Button key.\n" + " * On a game controller, the left thumb button indicates that the left (or only)\n" + " * joystick is pressed. */\n" + " public static final int KEYCODE_BUTTON_THUMBL = 106;\n" + " /** Key code constant: Right Thumb Button key.\n" + " * On a game controller, the right thumb button indicates that the right\n" + " * joystick is pressed. */\n" + " public static final int KEYCODE_BUTTON_THUMBR = 107;\n" + " /** Key code constant: Start Button key.\n" + " * On a game controller, the button labeled Start. */\n" + " public static final int KEYCODE_BUTTON_START = 108;\n" + " /** Key code constant: Select Button key.\n" + " * On a game controller, the button labeled Select. */\n" + " public static final int KEYCODE_BUTTON_SELECT = 109;\n" + " /** Key code constant: Mode Button key.\n" + " * On a game controller, the button labeled Mode. */\n" + " public static final int KEYCODE_BUTTON_MODE = 110;\n" + " /** Key code constant: Escape key. */\n" + " public static final int KEYCODE_ESCAPE = 111;\n" + " /** Key code constant: Forward Delete key.\n" + " * Deletes characters ahead of the insertion point, unlike {@link #KEYCODE_DEL}. */\n" + " public static final int KEYCODE_FORWARD_DEL = 112;\n" + " /** Key code constant: Left Control modifier key. */\n" + " public static final int KEYCODE_CTRL_LEFT = 113;\n" + " /** Key code constant: Right Control modifier key. */\n" + " public static final int KEYCODE_CTRL_RIGHT = 114;\n" + " /** Key code constant: Caps Lock key. */\n" + " public static final int KEYCODE_CAPS_LOCK = 115;\n" + " /** Key code constant: Scroll Lock key. */\n" + " public static final int KEYCODE_SCROLL_LOCK = 116;\n" + " /** Key code constant: Left Meta modifier key. */\n" + " public static final int KEYCODE_META_LEFT = 117;\n" + " /** Key code constant: Right Meta modifier key. */\n" + " public static final int KEYCODE_META_RIGHT = 118;\n" + " /** Key code constant: Function modifier key. */\n" + " public static final int KEYCODE_FUNCTION = 119;\n" + " /** Key code constant: System Request / Print Screen key. */\n" + " public static final int KEYCODE_SYSRQ = 120;\n" + " /** Key code constant: Break / Pause key. */\n" + " public static final int KEYCODE_BREAK = 121;\n" + " /** Key code constant: Home Movement key.\n" + " * Used for scrolling or moving the cursor around to the start of a line\n" + " * or to the top of a list. */\n" + " public static final int KEYCODE_MOVE_HOME = 122;\n" + " /** Key code constant: End Movement key.\n" + " * Used for scrolling or moving the cursor around to the end of a line\n" + " * or to the bottom of a list. */\n" + " public static final int KEYCODE_MOVE_END = 123;\n" + " /** Key code constant: Insert key.\n" + " * Toggles insert / overwrite edit mode. */\n" + " public static final int KEYCODE_INSERT = 124;\n" + " /** Key code constant: Forward key.\n" + " * Navigates forward in the history stack. Complement of {@link #KEYCODE_BACK}. */\n" + " public static final int KEYCODE_FORWARD = 125;\n" + " /** Key code constant: Play media key. */\n" + " public static final int KEYCODE_MEDIA_PLAY = 126;\n" + " /** Key code constant: Pause media key. */\n" + " public static final int KEYCODE_MEDIA_PAUSE = 127;\n" + " /** Key code constant: Close media key.\n" + " * May be used to close a CD tray, for example. */\n" + " public static final int KEYCODE_MEDIA_CLOSE = 128;\n" + " /** Key code constant: Eject media key.\n" + " * May be used to eject a CD tray, for example. */\n" + " public static final int KEYCODE_MEDIA_EJECT = 129;\n" + " /** Key code constant: Record media key. */\n" + " public static final int KEYCODE_MEDIA_RECORD = 130;\n" + " /** Key code constant: F1 key. */\n" + " public static final int KEYCODE_F1 = 131;\n" + " /** Key code constant: F2 key. */\n" + " public static final int KEYCODE_F2 = 132;\n" + " /** Key code constant: F3 key. */\n" + " public static final int KEYCODE_F3 = 133;\n" + " /** Key code constant: F4 key. */\n" + " public static final int KEYCODE_F4 = 134;\n" + " /** Key code constant: F5 key. */\n" + " public static final int KEYCODE_F5 = 135;\n" + " /** Key code constant: F6 key. */\n" + " public static final int KEYCODE_F6 = 136;\n" + " /** Key code constant: F7 key. */\n" + " public static final int KEYCODE_F7 = 137;\n" + " /** Key code constant: F8 key. */\n" + " public static final int KEYCODE_F8 = 138;\n" + " /** Key code constant: F9 key. */\n" + " public static final int KEYCODE_F9 = 139;\n" + " /** Key code constant: F10 key. */\n" + " public static final int KEYCODE_F10 = 140;\n" + " /** Key code constant: F11 key. */\n" + " public static final int KEYCODE_F11 = 141;\n" + " /** Key code constant: F12 key. */\n" + " public static final int KEYCODE_F12 = 142;\n" + " /** Key code constant: Num Lock key.\n" + " * This is the Num Lock key; it is different from {@link #KEYCODE_NUM}.\n" + " * This key alters the behavior of other keys on the numeric keypad. */\n" + " public static final int KEYCODE_NUM_LOCK = 143;\n" + " /** Key code constant: Numeric keypad '0' key. */\n" + " public static final int KEYCODE_NUMPAD_0 = 144;\n" + " /** Key code constant: Numeric keypad '1' key. */\n" + " public static final int KEYCODE_NUMPAD_1 = 145;\n" + " /** Key code constant: Numeric keypad '2' key. */\n" + " public static final int KEYCODE_NUMPAD_2 = 146;\n" + " /** Key code constant: Numeric keypad '3' key. */\n" + " public static final int KEYCODE_NUMPAD_3 = 147;\n" + " /** Key code constant: Numeric keypad '4' key. */\n" + " public static final int KEYCODE_NUMPAD_4 = 148;\n" + " /** Key code constant: Numeric keypad '5' key. */\n" + " public static final int KEYCODE_NUMPAD_5 = 149;\n" + " /** Key code constant: Numeric keypad '6' key. */\n" + " public static final int KEYCODE_NUMPAD_6 = 150;\n" + " /** Key code constant: Numeric keypad '7' key. */\n" + " public static final int KEYCODE_NUMPAD_7 = 151;\n" + " /** Key code constant: Numeric keypad '8' key. */\n" + " public static final int KEYCODE_NUMPAD_8 = 152;\n" + " /** Key code constant: Numeric keypad '9' key. */\n" + " public static final int KEYCODE_NUMPAD_9 = 153;\n" + " /** Key code constant: Numeric keypad '/' key (for division). */\n" + " public static final int KEYCODE_NUMPAD_DIVIDE = 154;\n" + " /** Key code constant: Numeric keypad '*' key (for multiplication). */\n" + " public static final int KEYCODE_NUMPAD_MULTIPLY = 155;\n" + " /** Key code constant: Numeric keypad '-' key (for subtraction). */\n" + " public static final int KEYCODE_NUMPAD_SUBTRACT = 156;\n" + " /** Key code constant: Numeric keypad '+' key (for addition). */\n" + " public static final int KEYCODE_NUMPAD_ADD = 157;\n" + " /** Key code constant: Numeric keypad '.' key (for decimals or digit grouping). */\n" + " public static final int KEYCODE_NUMPAD_DOT = 158;\n" + " /** Key code constant: Numeric keypad ',' key (for decimals or digit grouping). */\n" + " public static final int KEYCODE_NUMPAD_COMMA = 159;\n" + " /** Key code constant: Numeric keypad Enter key. */\n" + " public static final int KEYCODE_NUMPAD_ENTER = 160;\n" + " /** Key code constant: Numeric keypad '=' key. */\n" + " public static final int KEYCODE_NUMPAD_EQUALS = 161;\n" + " /** Key code constant: Numeric keypad '(' key. */\n" + " public static final int KEYCODE_NUMPAD_LEFT_PAREN = 162;\n" + " /** Key code constant: Numeric keypad ')' key. */\n" + " public static final int KEYCODE_NUMPAD_RIGHT_PAREN = 163;\n" + " /** Key code constant: Volume Mute key.\n" + " * Mute key for speaker (unlike {@link #KEYCODE_MUTE}, which is the mute key for the\n" + " * microphone). This key should normally be implemented as a toggle such that the first press\n" + " * mutes the speaker and the second press restores the original volume.\n" + " */\n" + " public static final int KEYCODE_VOLUME_MUTE = 164;\n" + " /** Key code constant: Info key.\n" + " * Common on TV remotes to show additional information related to what is\n" + " * currently being viewed. */\n" + " public static final int KEYCODE_INFO = 165;\n" + " /** Key code constant: Channel up key.\n" + " * On TV remotes, increments the television channel. */\n" + " public static final int KEYCODE_CHANNEL_UP = 166;\n" + " /** Key code constant: Channel down key.\n" + " * On TV remotes, decrements the television channel. */\n" + " public static final int KEYCODE_CHANNEL_DOWN = 167;\n" + " /** Key code constant: Zoom in key. */\n" + " public static final int KEYCODE_ZOOM_IN = 168;\n" + " /** Key code constant: Zoom out key. */\n" + " public static final int KEYCODE_ZOOM_OUT = 169;\n" + " /** Key code constant: TV key.\n" + " * On TV remotes, switches to viewing live TV. */\n" + " public static final int KEYCODE_TV = 170;\n" + " /** Key code constant: Window key.\n" + " * On TV remotes, toggles picture-in-picture mode or other windowing functions.\n" + " * On Android Wear devices, triggers a display offset. */\n" + " public static final int KEYCODE_WINDOW = 171;\n" + " /** Key code constant: Guide key.\n" + " * On TV remotes, shows a programming guide. */\n" + " public static final int KEYCODE_GUIDE = 172;\n" + " /** Key code constant: DVR key.\n" + " * On some TV remotes, switches to a DVR mode for recorded shows. */\n" + " public static final int KEYCODE_DVR = 173;\n" + " /** Key code constant: Bookmark key.\n" + " * On some TV remotes, bookmarks content or web pages. */\n" + " public static final int KEYCODE_BOOKMARK = 174;\n" + " /** Key code constant: Toggle captions key.\n" + " * Switches the mode for closed-captioning text, for example during television shows. */\n" + " public static final int KEYCODE_CAPTIONS = 175;\n" + " /** Key code constant: Settings key.\n" + " * Starts the system settings activity. */\n" + " public static final int KEYCODE_SETTINGS = 176;\n" + " /**\n" + " * Key code constant: TV power key.\n" + " * On HDMI TV panel devices and Android TV devices that don't support HDMI, toggles the power\n" + " * state of the device.\n" + " * On HDMI source devices, toggles the power state of the HDMI-connected TV via HDMI-CEC and\n" + " * makes the source device follow this power state.\n" + " */\n" + " public static final int KEYCODE_TV_POWER = 177;\n" + " /** Key code constant: TV input key.\n" + " * On TV remotes, switches the input on a television screen. */\n" + " public static final int KEYCODE_TV_INPUT = 178;\n" + " /** Key code constant: Set-top-box power key.\n" + " * On TV remotes, toggles the power on an external Set-top-box. */\n" + " public static final int KEYCODE_STB_POWER = 179;\n" + " /** Key code constant: Set-top-box input key.\n" + " * On TV remotes, switches the input mode on an external Set-top-box. */\n" + " public static final int KEYCODE_STB_INPUT = 180;\n" + " /** Key code constant: A/V Receiver power key.\n" + " * On TV remotes, toggles the power on an external A/V Receiver. */\n" + " public static final int KEYCODE_AVR_POWER = 181;\n" + " /** Key code constant: A/V Receiver input key.\n" + " * On TV remotes, switches the input mode on an external A/V Receiver. */\n" + " public static final int KEYCODE_AVR_INPUT = 182;\n" + " /** Key code constant: Red \"programmable\" key.\n" + " * On TV remotes, acts as a contextual/programmable key. */\n" + " public static final int KEYCODE_PROG_RED = 183;\n" + " /** Key code constant: Green \"programmable\" key.\n" + " * On TV remotes, actsas a contextual/programmable key. */\n" + " public static final int KEYCODE_PROG_GREEN = 184;\n" + " /** Key code constant: Yellow \"programmable\" key.\n" + " * On TV remotes, acts as a contextual/programmable key. */\n" + " public static final int KEYCODE_PROG_YELLOW = 185;\n" + " /** Key code constant: Blue \"programmable\" key.\n" + " * On TV remotes, acts as a contextual/programmable key. */\n" + " public static final int KEYCODE_PROG_BLUE = 186;\n" + " /** Key code constant: App switch key.\n" + " * Should bring up the application switcher dialog. */\n" + " public static final int KEYCODE_APP_SWITCH = 187;\n" + " /** Key code constant: Generic Game Pad Button #1.*/\n" + " public static final int KEYCODE_BUTTON_1 = 188;\n" + " /** Key code constant: Generic Game Pad Button #2.*/\n" + " public static final int KEYCODE_BUTTON_2 = 189;\n" + " /** Key code constant: Generic Game Pad Button #3.*/\n" + " public static final int KEYCODE_BUTTON_3 = 190;\n" + " /** Key code constant: Generic Game Pad Button #4.*/\n" + " public static final int KEYCODE_BUTTON_4 = 191;\n" + " /** Key code constant: Generic Game Pad Button #5.*/\n" + " public static final int KEYCODE_BUTTON_5 = 192;\n" + " /** Key code constant: Generic Game Pad Button #6.*/\n" + " public static final int KEYCODE_BUTTON_6 = 193;\n" + " /** Key code constant: Generic Game Pad Button #7.*/\n" + " public static final int KEYCODE_BUTTON_7 = 194;\n" + " /** Key code constant: Generic Game Pad Button #8.*/\n" + " public static final int KEYCODE_BUTTON_8 = 195;\n" + " /** Key code constant: Generic Game Pad Button #9.*/\n" + " public static final int KEYCODE_BUTTON_9 = 196;\n" + " /** Key code constant: Generic Game Pad Button #10.*/\n" + " public static final int KEYCODE_BUTTON_10 = 197;\n" + " /** Key code constant: Generic Game Pad Button #11.*/\n" + " public static final int KEYCODE_BUTTON_11 = 198;\n" + " /** Key code constant: Generic Game Pad Button #12.*/\n" + " public static final int KEYCODE_BUTTON_12 = 199;\n" + " /** Key code constant: Generic Game Pad Button #13.*/\n" + " public static final int KEYCODE_BUTTON_13 = 200;\n" + " /** Key code constant: Generic Game Pad Button #14.*/\n" + " public static final int KEYCODE_BUTTON_14 = 201;\n" + " /** Key code constant: Generic Game Pad Button #15.*/\n" + " public static final int KEYCODE_BUTTON_15 = 202;\n" + " /** Key code constant: Generic Game Pad Button #16.*/\n" + " public static final int KEYCODE_BUTTON_16 = 203;\n" + " /** Key code constant: Language Switch key.\n" + " * Toggles the current input language such as switching between English and Japanese on\n" + " * a QWERTY keyboard. On some devices, the same function may be performed by\n" + " * pressing Shift+Spacebar. */\n" + " public static final int KEYCODE_LANGUAGE_SWITCH = 204;\n" + " /** Key code constant: Manner Mode key.\n" + " * Toggles silent or vibrate mode on and off to make the device behave more politely\n" + " * in certain settings such as on a crowded train. On some devices, the key may only\n" + " * operate when long-pressed. */\n" + " public static final int KEYCODE_MANNER_MODE = 205;\n" + " /** Key code constant: 3D Mode key.\n" + " * Toggles the display between 2D and 3D mode. */\n" + " public static final int KEYCODE_3D_MODE = 206;\n" + " /** Key code constant: Contacts special function key.\n" + " * Used to launch an address book application. */\n" + " public static final int KEYCODE_CONTACTS = 207;\n" + " /** Key code constant: Calendar special function key.\n" + " * Used to launch a calendar application. */\n" + " public static final int KEYCODE_CALENDAR = 208;\n" + " /** Key code constant: Music special function key.\n" + " * Used to launch a music player application. */\n" + " public static final int KEYCODE_MUSIC = 209;\n" + " /** Key code constant: Calculator special function key.\n" + " * Used to launch a calculator application. */\n" + " public static final int KEYCODE_CALCULATOR = 210;\n" + " /** Key code constant: Japanese full-width / half-width key. */\n" + " public static final int KEYCODE_ZENKAKU_HANKAKU = 211;\n" + " /** Key code constant: Japanese alphanumeric key. */\n" + " public static final int KEYCODE_EISU = 212;\n" + " /** Key code constant: Japanese non-conversion key. */\n" + " public static final int KEYCODE_MUHENKAN = 213;\n" + " /** Key code constant: Japanese conversion key. */\n" + " public static final int KEYCODE_HENKAN = 214;\n" + " /** Key code constant: Japanese katakana / hiragana key. */\n" + " public static final int KEYCODE_KATAKANA_HIRAGANA = 215;\n" + " /** Key code constant: Japanese Yen key. */\n" + " public static final int KEYCODE_YEN = 216;\n" + " /** Key code constant: Japanese Ro key. */\n" + " public static final int KEYCODE_RO = 217;\n" + " /** Key code constant: Japanese kana key. */\n" + " public static final int KEYCODE_KANA = 218;\n" + " /** Key code constant: Assist key.\n" + " * Launches the global assist activity. Not delivered to applications. */\n" + " public static final int KEYCODE_ASSIST = 219;\n" + " /** Key code constant: Brightness Down key.\n" + " * Adjusts the screen brightness down. */\n" + " public static final int KEYCODE_BRIGHTNESS_DOWN = 220;\n" + " /** Key code constant: Brightness Up key.\n" + " * Adjusts the screen brightness up. */\n" + " public static final int KEYCODE_BRIGHTNESS_UP = 221;\n" + " /** Key code constant: Audio Track key.\n" + " * Switches the audio tracks. */\n" + " public static final int KEYCODE_MEDIA_AUDIO_TRACK = 222;\n" + " /** Key code constant: Sleep key.\n" + " * Puts the device to sleep. Behaves somewhat like {@link #KEYCODE_POWER} but it\n" + " * has no effect if the device is already asleep. */\n" + " public static final int KEYCODE_SLEEP = 223;\n" + " /** Key code constant: Wakeup key.\n" + " * Wakes up the device. Behaves somewhat like {@link #KEYCODE_POWER} but it\n" + " * has no effect if the device is already awake. */\n" + " public static final int KEYCODE_WAKEUP = 224;\n" + " /** Key code constant: Pairing key.\n" + " * Initiates peripheral pairing mode. Useful for pairing remote control\n" + " * devices or game controllers, especially if no other input mode is\n" + " * available. */\n" + " public static final int KEYCODE_PAIRING = 225;\n" + " /** Key code constant: Media Top Menu key.\n" + " * Goes to the top of media menu. */\n" + " public static final int KEYCODE_MEDIA_TOP_MENU = 226;\n" + " /** Key code constant: '11' key. */\n" + " public static final int KEYCODE_11 = 227;\n" + " /** Key code constant: '12' key. */\n" + " public static final int KEYCODE_12 = 228;\n" + " /** Key code constant: Last Channel key.\n" + " * Goes to the last viewed channel. */\n" + " public static final int KEYCODE_LAST_CHANNEL = 229;\n" + " /** Key code constant: TV data service key.\n" + " * Displays data services like weather, sports. */\n" + " public static final int KEYCODE_TV_DATA_SERVICE = 230;\n" + " /** Key code constant: Voice Assist key.\n" + " * Launches the global voice assist activity. Not delivered to applications. */\n" + " public static final int KEYCODE_VOICE_ASSIST = 231;\n" + " /** Key code constant: Radio key.\n" + " * Toggles TV service / Radio service. */\n" + " public static final int KEYCODE_TV_RADIO_SERVICE = 232;\n" + " /** Key code constant: Teletext key.\n" + " * Displays Teletext service. */\n" + " public static final int KEYCODE_TV_TELETEXT = 233;\n" + " /** Key code constant: Number entry key.\n" + " * Initiates to enter multi-digit channel nubmber when each digit key is assigned\n" + " * for selecting separate channel. Corresponds to Number Entry Mode (0x1D) of CEC\n" + " * User Control Code. */\n" + " public static final int KEYCODE_TV_NUMBER_ENTRY = 234;\n" + " /** Key code constant: Analog Terrestrial key.\n" + " * Switches to analog terrestrial broadcast service. */\n" + " public static final int KEYCODE_TV_TERRESTRIAL_ANALOG = 235;\n" + " /** Key code constant: Digital Terrestrial key.\n" + " * Switches to digital terrestrial broadcast service. */\n" + " public static final int KEYCODE_TV_TERRESTRIAL_DIGITAL = 236;\n" + " /** Key code constant: Satellite key.\n" + " * Switches to digital satellite broadcast service. */\n" + " public static final int KEYCODE_TV_SATELLITE = 237;\n" + " /** Key code constant: BS key.\n" + " * Switches to BS digital satellite broadcasting service available in Japan. */\n" + " public static final int KEYCODE_TV_SATELLITE_BS = 238;\n" + " /** Key code constant: CS key.\n" + " * Switches to CS digital satellite broadcasting service available in Japan. */\n" + " public static final int KEYCODE_TV_SATELLITE_CS = 239;\n" + " /** Key code constant: BS/CS key.\n" + " * Toggles between BS and CS digital satellite services. */\n" + " public static final int KEYCODE_TV_SATELLITE_SERVICE = 240;\n" + " /** Key code constant: Toggle Network key.\n" + " * Toggles selecting broacast services. */\n" + " public static final int KEYCODE_TV_NETWORK = 241;\n" + " /** Key code constant: Antenna/Cable key.\n" + " * Toggles broadcast input source between antenna and cable. */\n" + " public static final int KEYCODE_TV_ANTENNA_CABLE = 242;\n" + " /** Key code constant: HDMI #1 key.\n" + " * Switches to HDMI input #1. */\n" + " public static final int KEYCODE_TV_INPUT_HDMI_1 = 243;\n" + " /** Key code constant: HDMI #2 key.\n" + " * Switches to HDMI input #2. */\n" + " public static final int KEYCODE_TV_INPUT_HDMI_2 = 244;\n" + " /** Key code constant: HDMI #3 key.\n" + " * Switches to HDMI input #3. */\n" + " public static final int KEYCODE_TV_INPUT_HDMI_3 = 245;\n" + " /** Key code constant: HDMI #4 key.\n" + " * Switches to HDMI input #4. */\n" + " public static final int KEYCODE_TV_INPUT_HDMI_4 = 246;\n" + " /** Key code constant: Composite #1 key.\n" + " * Switches to composite video input #1. */\n" + " public static final int KEYCODE_TV_INPUT_COMPOSITE_1 = 247;\n" + " /** Key code constant: Composite #2 key.\n" + " * Switches to composite video input #2. */\n" + " public static final int KEYCODE_TV_INPUT_COMPOSITE_2 = 248;\n" + " /** Key code constant: Component #1 key.\n" + " * Switches to component video input #1. */\n" + " public static final int KEYCODE_TV_INPUT_COMPONENT_1 = 249;\n" + " /** Key code constant: Component #2 key.\n" + " * Switches to component video input #2. */\n" + " public static final int KEYCODE_TV_INPUT_COMPONENT_2 = 250;\n" + " /** Key code constant: VGA #1 key.\n" + " * Switches to VGA (analog RGB) input #1. */\n" + " public static final int KEYCODE_TV_INPUT_VGA_1 = 251;\n" + " /** Key code constant: Audio description key.\n" + " * Toggles audio description off / on. */\n" + " public static final int KEYCODE_TV_AUDIO_DESCRIPTION = 252;\n" + " /** Key code constant: Audio description mixing volume up key.\n" + " * Louden audio description volume as compared with normal audio volume. */\n" + " public static final int KEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP = 253;\n" + " /** Key code constant: Audio description mixing volume down key.\n" + " * Lessen audio description volume as compared with normal audio volume. */\n" + " public static final int KEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN = 254;\n" + " /** Key code constant: Zoom mode key.\n" + " * Changes Zoom mode (Normal, Full, Zoom, Wide-zoom, etc.) */\n" + " public static final int KEYCODE_TV_ZOOM_MODE = 255;\n" + " /** Key code constant: Contents menu key.\n" + " * Goes to the title list. Corresponds to Contents Menu (0x0B) of CEC User Control\n" + " * Code */\n" + " public static final int KEYCODE_TV_CONTENTS_MENU = 256;\n" + " /** Key code constant: Media context menu key.\n" + " * Goes to the context menu of media contents. Corresponds to Media Context-sensitive\n" + " * Menu (0x11) of CEC User Control Code. */\n" + " public static final int KEYCODE_TV_MEDIA_CONTEXT_MENU = 257;\n" + " /** Key code constant: Timer programming key.\n" + " * Goes to the timer recording menu. Corresponds to Timer Programming (0x54) of\n" + " * CEC User Control Code. */\n" + " public static final int KEYCODE_TV_TIMER_PROGRAMMING = 258;\n" + " /** Key code constant: Help key. */\n" + " public static final int KEYCODE_HELP = 259;\n" + " /** Key code constant: Navigate to previous key.\n" + " * Goes backward by one item in an ordered collection of items. */\n" + " public static final int KEYCODE_NAVIGATE_PREVIOUS = 260;\n" + " /** Key code constant: Navigate to next key.\n" + " * Advances to the next item in an ordered collection of items. */\n" + " public static final int KEYCODE_NAVIGATE_NEXT = 261;\n" + " /** Key code constant: Navigate in key.\n" + " * Activates the item that currently has focus or expands to the next level of a navigation\n" + " * hierarchy. */\n" + " public static final int KEYCODE_NAVIGATE_IN = 262;\n" + " /** Key code constant: Navigate out key.\n" + " * Backs out one level of a navigation hierarchy or collapses the item that currently has\n" + " * focus. */\n" + " public static final int KEYCODE_NAVIGATE_OUT = 263;\n" + " /** Key code constant: Primary stem key for Wear\n" + " * Main power/reset button on watch. */\n" + " public static final int KEYCODE_STEM_PRIMARY = 264;\n" + " /** Key code constant: Generic stem key 1 for Wear */\n" + " public static final int KEYCODE_STEM_1 = 265;\n" + " /** Key code constant: Generic stem key 2 for Wear */\n" + " public static final int KEYCODE_STEM_2 = 266;\n" + " /** Key code constant: Generic stem key 3 for Wear */\n" + " public static final int KEYCODE_STEM_3 = 267;\n" + " /** Key code constant: Directional Pad Up-Left */\n" + " public static final int KEYCODE_DPAD_UP_LEFT = 268;\n" + " /** Key code constant: Directional Pad Down-Left */\n" + " public static final int KEYCODE_DPAD_DOWN_LEFT = 269;\n" + " /** Key code constant: Directional Pad Up-Right */\n" + " public static final int KEYCODE_DPAD_UP_RIGHT = 270;\n" + " /** Key code constant: Directional Pad Down-Right */\n" + " public static final int KEYCODE_DPAD_DOWN_RIGHT = 271;\n" + " /** Key code constant: Skip forward media key. */\n" + " public static final int KEYCODE_MEDIA_SKIP_FORWARD = 272;\n" + " /** Key code constant: Skip backward media key. */\n" + " public static final int KEYCODE_MEDIA_SKIP_BACKWARD = 273;\n" + " /** Key code constant: Step forward media key.\n" + " * Steps media forward, one frame at a time. */\n" + " public static final int KEYCODE_MEDIA_STEP_FORWARD = 274;\n" + " /** Key code constant: Step backward media key.\n" + " * Steps media backward, one frame at a time. */\n" + " public static final int KEYCODE_MEDIA_STEP_BACKWARD = 275;\n" + " /** Key code constant: put device to sleep unless a wakelock is held. */\n" + " public static final int KEYCODE_SOFT_SLEEP = 276;\n" + " /** Key code constant: Cut key. */\n" + " public static final int KEYCODE_CUT = 277;\n" + " /** Key code constant: Copy key. */\n" + " public static final int KEYCODE_COPY = 278;\n" + " /** Key code constant: Paste key. */\n" + " public static final int KEYCODE_PASTE = 279;\n" + " /** Key code constant: Consumed by the system for navigation up */\n" + " public static final int KEYCODE_SYSTEM_NAVIGATION_UP = 280;\n" + " /** Key code constant: Consumed by the system for navigation down */\n" + " public static final int KEYCODE_SYSTEM_NAVIGATION_DOWN = 281;\n" + " /** Key code constant: Consumed by the system for navigation left*/\n" + " public static final int KEYCODE_SYSTEM_NAVIGATION_LEFT = 282;\n" + " /** Key code constant: Consumed by the system for navigation right */\n" + " public static final int KEYCODE_SYSTEM_NAVIGATION_RIGHT = 283;\n" + " /** Key code constant: Show all apps */\n" + " public static final int KEYCODE_ALL_APPS = 284;\n" + " /** Key code constant: Refresh key. */\n" + " public static final int KEYCODE_REFRESH = 285;\n" + " /** Key code constant: Thumbs up key. Apps can use this to let user upvote content. */\n" + " public static final int KEYCODE_THUMBS_UP = 286;\n" + " /** Key code constant: Thumbs down key. Apps can use this to let user downvote content. */\n" + " public static final int KEYCODE_THUMBS_DOWN = 287;\n" + " /**\n" + " * Key code constant: Used to switch current {@link android.accounts.Account} that is\n" + " * consuming content. May be consumed by system to set account globally.\n" + " */\n" + " public static final int KEYCODE_PROFILE_SWITCH = 288;\n" + " /** Key code constant: Video Application key #1. */\n" + " public static final int KEYCODE_VIDEO_APP_1 = 289;\n" + " /** Key code constant: Video Application key #2. */\n" + " public static final int KEYCODE_VIDEO_APP_2 = 290;\n" + " /** Key code constant: Video Application key #3. */\n" + " public static final int KEYCODE_VIDEO_APP_3 = 291;\n" + " /** Key code constant: Video Application key #4. */\n" + " public static final int KEYCODE_VIDEO_APP_4 = 292;\n" + " /** Key code constant: Video Application key #5. */\n" + " public static final int KEYCODE_VIDEO_APP_5 = 293;\n" + " /** Key code constant: Video Application key #6. */\n" + " public static final int KEYCODE_VIDEO_APP_6 = 294;\n" + " /** Key code constant: Video Application key #7. */\n" + " public static final int KEYCODE_VIDEO_APP_7 = 295;\n" + " /** Key code constant: Video Application key #8. */\n" + " public static final int KEYCODE_VIDEO_APP_8 = 296;\n" + " /** Key code constant: Featured Application key #1. */\n" + " public static final int KEYCODE_FEATURED_APP_1 = 297;\n" + " /** Key code constant: Featured Application key #2. */\n" + " public static final int KEYCODE_FEATURED_APP_2 = 298;\n" + " /** Key code constant: Featured Application key #3. */\n" + " public static final int KEYCODE_FEATURED_APP_3 = 299;\n" + " /** Key code constant: Featured Application key #4. */\n" + " public static final int KEYCODE_FEATURED_APP_4 = 300;\n" + " /** Key code constant: Demo Application key #1. */\n" + " public static final int KEYCODE_DEMO_APP_1 = 301;\n" + " /** Key code constant: Demo Application key #2. */\n" + " public static final int KEYCODE_DEMO_APP_2 = 302;\n" + " /** Key code constant: Demo Application key #3. */\n" + " public static final int KEYCODE_DEMO_APP_3 = 303;\n" + " /** Key code constant: Demo Application key #4. */\n" + " public static final int KEYCODE_DEMO_APP_4 = 304;\n" + " public static final int META_ALT_ON = 0x02;\n" + " /**\n" + " * <p>This mask is used to check whether the left ALT meta key is pressed.</p>\n" + " *\n" + " * @see #isAltPressed()\n" + " * @see #getMetaState()\n" + " * @see #KEYCODE_ALT_LEFT\n" + " */\n" + " public static final int META_ALT_LEFT_ON = 0x10;\n" + " /**\n" + " * <p>This mask is used to check whether the right the ALT meta key is pressed.</p>\n" + " *\n" + " * @see #isAltPressed()\n" + " * @see #getMetaState()\n" + " * @see #KEYCODE_ALT_RIGHT\n" + " */\n" + " public static final int META_ALT_RIGHT_ON = 0x20;\n" + " /**\n" + " * <p>This mask is used to check whether one of the SHIFT meta keys is pressed.</p>\n" + " *\n" + " * @see #isShiftPressed()\n" + " * @see #getMetaState()\n" + " * @see #KEYCODE_SHIFT_LEFT\n" + " * @see #KEYCODE_SHIFT_RIGHT\n" + " */\n" + " public static final int META_SHIFT_ON = 0x1;\n" + " /**\n" + " * <p>This mask is used to check whether the left SHIFT meta key is pressed.</p>\n" + " *\n" + " * @see #isShiftPressed()\n" + " * @see #getMetaState()\n" + " * @see #KEYCODE_SHIFT_LEFT\n" + " */\n" + " public static final int META_SHIFT_LEFT_ON = 0x40;\n" + " /**\n" + " * <p>This mask is used to check whether the right SHIFT meta key is pressed.</p>\n" + " *\n" + " * @see #isShiftPressed()\n" + " * @see #getMetaState()\n" + " * @see #KEYCODE_SHIFT_RIGHT\n" + " */\n" + " public static final int META_SHIFT_RIGHT_ON = 0x80;\n" + " /**\n" + " * <p>This mask is used to check whether the SYM meta key is pressed.</p>\n" + " *\n" + " * @see #isSymPressed()\n" + " * @see #getMetaState()\n" + " */\n" + " public static final int META_SYM_ON = 0x4;\n" + " /**\n" + " * <p>This mask is used to check whether the FUNCTION meta key is pressed.</p>\n" + " *\n" + " * @see #isFunctionPressed()\n" + " * @see #getMetaState()\n" + " */\n" + " public static final int META_FUNCTION_ON = 0x8;\n" + " /**\n" + " * <p>This mask is used to check whether one of the CTRL meta keys is pressed.</p>\n" + " *\n" + " * @see #isCtrlPressed()\n" + " * @see #getMetaState()\n" + " * @see #KEYCODE_CTRL_LEFT\n" + " * @see #KEYCODE_CTRL_RIGHT\n" + " */\n" + " public static final int META_CTRL_ON = 0x1000;\n" + " /**\n" + " * <p>This mask is used to check whether the left CTRL meta key is pressed.</p>\n" + " *\n" + " * @see #isCtrlPressed()\n" + " * @see #getMetaState()\n" + " * @see #KEYCODE_CTRL_LEFT\n" + " */\n" + " public static final int META_CTRL_LEFT_ON = 0x2000;\n" + " /**\n" + " * <p>This mask is used to check whether the right CTRL meta key is pressed.</p>\n" + " *\n" + " * @see #isCtrlPressed()\n" + " * @see #getMetaState()\n" + " * @see #KEYCODE_CTRL_RIGHT\n" + " */\n" + " public static final int META_CTRL_RIGHT_ON = 0x4000;\n" + " /**\n" + " * <p>This mask is used to check whether one of the META meta keys is pressed.</p>\n" + " *\n" + " * @see #isMetaPressed()\n" + " * @see #getMetaState()\n" + " * @see #KEYCODE_META_LEFT\n" + " * @see #KEYCODE_META_RIGHT\n" + " */\n" + " public static final int META_META_ON = 0x10000;\n" + " /**\n" + " * <p>This mask is used to check whether the left META meta key is pressed.</p>\n" + " *\n" + " * @see #isMetaPressed()\n" + " * @see #getMetaState()\n" + " * @see #KEYCODE_META_LEFT\n" + " */\n" + " public static final int META_META_LEFT_ON = 0x20000;\n" + " /**\n" + " * <p>This mask is used to check whether the right META meta key is pressed.</p>\n" + " *\n" + " * @see #isMetaPressed()\n" + " * @see #getMetaState()\n" + " * @see #KEYCODE_META_RIGHT\n" + " */\n" + " public static final int META_META_RIGHT_ON = 0x40000;\n" + " /**\n" + " * <p>This mask is used to check whether the CAPS LOCK meta key is on.</p>\n" + " *\n" + " * @see #isCapsLockOn()\n" + " * @see #getMetaState()\n" + " * @see #KEYCODE_CAPS_LOCK\n" + " */\n" + " public static final int META_CAPS_LOCK_ON = 0x100000;\n" + " /**\n" + " * <p>This mask is used to check whether the NUM LOCK meta key is on.</p>\n" + " *\n" + " * @see #isNumLockOn()\n" + " * @see #getMetaState()\n" + " * @see #KEYCODE_NUM_LOCK\n" + " */\n" + " public static final int META_NUM_LOCK_ON = 0x200000;\n" + " /**\n" + " * <p>This mask is used to check whether the SCROLL LOCK meta key is on.</p>\n" + " *\n" + " * @see #isScrollLockOn()\n" + " * @see #getMetaState()\n" + " * @see #KEYCODE_SCROLL_LOCK\n" + " */\n" + " public static final int META_SCROLL_LOCK_ON = 0x400000;\n" + " /**\n" + " * This mask is a combination of {@link #META_SHIFT_ON}, {@link #META_SHIFT_LEFT_ON}\n" + " * and {@link #META_SHIFT_RIGHT_ON}.\n" + " */\n" + " public static final int META_SHIFT_MASK = META_SHIFT_ON\n" + " | META_SHIFT_LEFT_ON | META_SHIFT_RIGHT_ON;\n" + " /**\n" + " * This mask is a combination of {@link #META_ALT_ON}, {@link #META_ALT_LEFT_ON}\n" + " * and {@link #META_ALT_RIGHT_ON}.\n" + " */\n" + " public static final int META_ALT_MASK = META_ALT_ON\n" + " | META_ALT_LEFT_ON | META_ALT_RIGHT_ON;\n" + " /**\n" + " * This mask is a combination of {@link #META_CTRL_ON}, {@link #META_CTRL_LEFT_ON}\n" + " * and {@link #META_CTRL_RIGHT_ON}.\n" + " */\n" + " public static final int META_CTRL_MASK = META_CTRL_ON\n" + " | META_CTRL_LEFT_ON | META_CTRL_RIGHT_ON;\n" + " /**\n" + " * This mask is a combination of {@link #META_META_ON}, {@link #META_META_LEFT_ON}\n" + " * and {@link #META_META_RIGHT_ON}.\n" + " */\n" + " public static final int META_META_MASK = META_META_ON\n" + " | META_META_LEFT_ON | META_META_RIGHT_ON;\n" + " /**\n" + " * This mask is set if the device woke because of this key event.\n" + " *\n" + " * @deprecated This flag will never be set by the system since the system\n" + " * consumes all wake keys itself.\n" + " */\n" + " @Deprecated\n" + " public static final int FLAG_WOKE_HERE = 0x1;\n" + " /**\n" + " * This mask is set if the key event was generated by a software keyboard.\n" + " */\n" + " public static final int FLAG_SOFT_KEYBOARD = 0x2;\n" + " /**\n" + " * This mask is set if we don't want the key event to cause us to leave\n" + " * touch mode.\n" + " */\n" + " public static final int FLAG_KEEP_TOUCH_MODE = 0x4;\n" + " /**\n" + " * This mask is set if an event was known to come from a trusted part\n" + " * of the system. That is, the event is known to come from the user,\n" + " * and could not have been spoofed by a third party component.\n" + " */\n" + " public static final int FLAG_FROM_SYSTEM = 0x8;\n" + " /**\n" + " * This mask is used for compatibility, to identify enter keys that are\n" + " * coming from an IME whose enter key has been auto-labelled \"next\" or\n" + " * \"done\". This allows TextView to dispatch these as normal enter keys\n" + " * for old applications, but still do the appropriate action when\n" + " * receiving them.\n" + " */\n" + " public static final int FLAG_EDITOR_ACTION = 0x10;\n" + " /**\n" + " * When associated with up key events, this indicates that the key press\n" + " * has been canceled. Typically this is used with virtual touch screen\n" + " * keys, where the user can slide from the virtual key area on to the\n" + " * display: in that case, the application will receive a canceled up\n" + " * event and should not perform the action normally associated with the\n" + " * key. Note that for this to work, the application can not perform an\n" + " * action for a key until it receives an up or the long press timeout has\n" + " * expired.\n" + " */\n" + " public static final int FLAG_CANCELED = 0x20;\n" + " /**\n" + " * This key event was generated by a virtual (on-screen) hard key area.\n" + " * Typically this is an area of the touchscreen, outside of the regular\n" + " * display, dedicated to \"hardware\" buttons.\n" + " */\n" + " public static final int FLAG_VIRTUAL_HARD_KEY = 0x40;\n" + " /**\n" + " * This flag is set for the first key repeat that occurs after the\n" + " * long press timeout.\n" + " */\n" + " public static final int FLAG_LONG_PRESS = 0x80;\n" + " /**\n" + " * Set when a key event has {@link #FLAG_CANCELED} set because a long\n" + " * press action was executed while it was down.\n" + " */\n" + " public static final int FLAG_CANCELED_LONG_PRESS = 0x100;\n" + " /**\n" + " * Set for {@link #ACTION_UP} when this event's key code is still being\n" + " * tracked from its initial down. That is, somebody requested that tracking\n" + " * started on the key down and a long press has not caused\n" + " * the tracking to be canceled.\n" + " */\n" + " public static final int FLAG_TRACKING = 0x200;\n" + " /**\n" + " * Set when a key event has been synthesized to implement default behavior\n" + " * for an event that the application did not handle.\n" + " * Fallback key events are generated by unhandled trackball motions\n" + " * (to emulate a directional keypad) and by certain unhandled key presses\n" + " * that are declared in the key map (such as special function numeric keypad\n" + " * keys when numlock is off).\n" + " */\n" + " public static final int FLAG_FALLBACK = 0x400;\n" + " /**\n" + " * This flag indicates that this event was modified by or generated from an accessibility\n" + " * service. Value = 0x800\n" + " * @hide\n" + " */\n" + " @TestApi\n" + " public static final int FLAG_IS_ACCESSIBILITY_EVENT = INPUT_EVENT_FLAG_IS_ACCESSIBILITY_EVENT;\n" + " /**\n" + " * Signifies that the key is being predispatched.\n" + " * @hide\n" + " */\n" + " public static final int FLAG_PREDISPATCH = 0x20000000;\n" + " /**\n" + " * Private control to determine when an app is tracking a key sequence.\n" + " * @hide\n" + " */\n" + " public static final int FLAG_START_TRACKING = 0x40000000;\n" + " /**\n" + " * Private flag that indicates when the system has detected that this key event\n" + " * may be inconsistent with respect to the sequence of previously delivered key events,\n" + " * such as when a key up event is sent but the key was not down.\n" + " *\n" + " * @hide\n" + " * @see #isTainted\n" + " * @see #setTainted\n" + " */\n" + " public static final int FLAG_TAINTED = 0x80000000;"; final String subst = ""; final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE); final Matcher matcher = pattern.matcher(string); // The substituted value will be contained in the result variable final String result = matcher.replaceAll(subst); System.out.println("Substitution result: " + result); } }

Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html