Monday, February 29, 2016

Easier regular expressions in Android Studio

Writing regular expressions patterns (see Wikipedia in any programming language can be a touch and go affair sometimes. In Android Studio, I found out a Regular Expression Checker tool that you can use to check the correctness of the regular expression. In order to use the tool, it must be activated first, by doing the following:

  1. In the Android Studio editor, place a cursor on the regular expression string.

    A light bulb icon appears on the left.
  2. Either click the light bulb. Or press OPTION+RETURN (on the Mac) or ALT+RETURN (on Windows).

    A pop up menu appears.

  3. Select Check RegExp.

    A dialog box appears.

  4. In the Sample entry field, type in a text string to test with the regular expression pattern.

    If the text string has the regular expression pattern, Matches will be displayed at the bottom right.

    If the text string does not match the pattern, no match will be displayed at the bottom right.

No comments:

Related Posts with Thumbnails