Skip to content

Conversation

@lerouquin
Copy link

Added a check for plain strings (single or double quoted).

This also resolves the following issue:

Before :

{"my string.with a dot"|myFunction}
outputs to
<?php echo myFunction( my string["with a dot"] ); ?>
which results in a parse error.

After :

{"my string.with a dot"|myFunction}
outputs to
<?php echo myFunction( "my string.with a dot" ); ?>
which is the expected behavior.

Added a check for plain strings (single or double quoted)
@eliemichel
Copy link
Contributor

Please comment the regex to explain what it is intended to match!

  1. Is it useful to "mute" parenthesis with ?: here?
  2. \\\' is not a valid escape sequence. If you want to match \', you need to add one more backslash.
  3. What is I want to end a string with a single backslash? "foo\" will fail since the backslash escapes the colon. But "foo\\" will display an extra backslash.

#"((\\(\\|"))|[^\\"])*?"# should work to match a double colon string. (escape it again to include it inside a PHP string).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants