question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

C-Like Single Line Comment Regex Matches Double Slash in Strings

See original GitHub issue

The single line comment pattern /(^|[^\\:])\/\/.*/ incorrectly matches the double slash in the string:

final String rcal = "ejb:jboss-ejb-multi-server-app-main/ejb//" + ("MainAppBean") + "!" + MainApp.class.getName();

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Golmotecommented, Feb 9, 2018

The key difference would probably be the addition of the greedy key on the string pattern, rather than a change in the comment pattern. Please keep us informed if the issue is fixed.

1reaction
Golmotecommented, Feb 9, 2018

Hi! Thanks for reporting. I don’t reproduce the issue on the test page. Can you make sure you’re using the last version of Prism please?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to REGEX // in C? Single line comments - Stack Overflow
A single-line comment expression starting with '//' can be captured by the following regular expression. \/\/[^\r\n]*. \/\/ matches the double-slash
Read more >
Single-Line Comments - Regular Expressions Cookbook, 2nd ...
Single -Line Comments Problem You want to match a comment that starts with ... Some programming languages use forward slashes to delimit regular...
Read more >
Finding Comments in Source Code Using Regular Expressions
Regular expressions are greedy, they take in as much as they can. Consider the case in which your file has two comments. This...
Read more >
Remove double-slash comments - regex101
Are you sure you want to delete this regex? This action is non-reversible and will delete all versions of this regex. The data...
Read more >
Regular expressions
Regular expressions are the default pattern engine in stringr. ... Like strings, regexps use the backslash, \ , to escape special behaviour. So...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found