How to Access Regular Expression Test Tool in PhpStorm? - SOLVED

How do I access the PhpStorm regex tester tool when the regex pattern is defined in a variable string?

My PhpStorm Tip of the Day says the following:

The format of a regular expression can be rather complicated. To make sure you didn't miss some slash of quotation mark, place the caret somewhere in the expression you want to check, and press ⌥⏎.

In the pop-up frame type a string that you think should match your regular expression. If the background turns green, you are lucky. If it turns red, then you have to look for a mistake.

I several regex patterns defined as strings in PHP variables and constants but I can't access that regex tool via option-return to check those patterns. Instead, I get string-related options:

PhpStorm 10.0.4, Mac OS X El Capitan

0
11 comments

Hi there,

Inject RegEx language first -- the string content must be recognized as RegEx in order for that tool to appear in this menu

1
Avatar
Permanently deleted user

That was the answer. Thanks!

0
Avatar
Permanently deleted user

I followed the instructions above and got the Check Regexp po-pup, inserted a long text in the tiny field, tried to make it bigger an it disappeared. Now it won't pop up anymore. I already restarted phpStorm, but it does not pop up. What can I do now? Is there another way to get to the Check Regex popup?

0
Avatar
Permanently deleted user

@An After you try to open that Check Regex window and see nothing, could you check the Help > Show Log in ... > idea.log file for any recent errors or warnings?

0
Avatar
Permanently deleted user

@Vladimir: Nothing got written to the log. Is there something like a verbose/debug mode so more stuff gets logged?

0

Do you still have the Check RegExp entry in the Alt+Enter menu?



The idea is that the injection has been reset, and thus PhpStorm does not longer realize it's a RegEx.

0
Avatar
Permanently deleted user

Yes, it is still there. Meanwhile I restarted my machine (mac os 10.12.5) too. Maybe it is related to that I pasted a very long string to check the regex (complete code of an html document) and maybe phpStorm still wants to reload it and can't. May you check if I paste a test string to check on and close phpStorm, the test sting is gone o still there? Another thing was, that I tried to resize the window, as the test string was long and the popup to small. While I was doing that the mouse jumped and maybe it reduced the size of the pop-up to 0? I can't tell exactly but it went away very quick and didn't come back.

0
Avatar
Permanently deleted user

I started a new project and Check RegExp works there. So it's a bug and project related. I manually edited .idea/workspace.xml and changed the value attribute in <property name="last.edited.regexp" value="(...)" />, where value was a 10546 characters long string.

0

Could you please share this string with us? Maybe it's worth a bug report.

0
Avatar
Permanently deleted user

Yes, it's a bug, but it's not related to any string in special. Just ad a string with plenty line breaks to fill the box. If it gets bigger than the window it won't open. such a big string does not make much sense in the way the RegEx Check works .. I thought before that it works more like reggy (see https://github.com/samsouder/reggy).

0
Avatar
Permanently deleted user

Example, copied from workspace.xml:

<property name="last.edited.regexp" value="Hello Word&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;:)&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;&#10;:(&#10;&#10;&#10;" />

0

Please sign in to leave a comment.