![]() Please don’t ask me to explain this in all its intricacies, it would take me a day and another. My $boolean_type = qr! (?is obviously some way out but my idea is to emphasize how bad-looking the regex will become. ![]() but Murphy's law says that you can have it). Now, what if you have /* or */ inside // block? (I dont know why would you have it. But, the actual regex would be even more complex as you would have not one but more of multi-line comments. One approach can be to first run whole of you code to match multiline comments and then take out only the parts not matching. (// or /* */)įor '//', you can have a regex to exclude //.* But, better could be to first put a regex to compare the whole line for the // comments ((.*)(//.*)) and then apply replacement only on $1 (first matching pattern).įor /* */, it is more complex as this is multiline pattern. ![]() But what if you have quote(") inside the string? So, you have more work to not exclude (\") pattern.Ĥ) Do not match if in a comment. You can perhaps write a reg ex to check ".*Boolean.*". 3) Do not match if in the middle of a string (thanks nohat). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |