Community
    • Login
    1. Home
    2. Popular
    Log in to post
    • All Time
    • Day
    • Week
    • Month
    • All Topics
    • New Topics
    • Watched Topics
    • Unreplied Topics

    • All categories
    • dr ramaanandD

      With the help of a Regex, how to find "code" preceded by a "<" only if "code {" is absent between "<style" and "</style>" in the css section which is below ?

      Watching Ignoring Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
      8
      0 Votes
      8 Posts
      239 Views
      guy038G
      Hi, @dr-ramaanand and all, Ah…, OK. So I changed my line of reasoning : Instead of looking for zones which do not contain the string code\x20?{, I’m looking for sections which do contain the string code\x20?{ Then, using the well-known backtracking control verbs (*SKIP)(*F), I omit these cases and look for the string <code, in all the other cases !! Thus, the following regex should solve your problem : (?xs-i) <code (?:(?!</style>).)+? </code> (?:(?!</style>).)+? <style\x20 (?:(?!</style>).)*? code\x20?{ .+? </style> (*SKIP) (*F) | <code Test it against the sample text, below : <code............>............</code> <style type="text/css"> code{ font-family: &quot;verdana&quot;; font-size: 19px; color: black; font-weight: bold !important; line-height: 1 !important; } } </style> <code............>............</code> <style type="text/css"> </style> <code............>............</code> bla blah bla blah bla blah <style type="text/css"> code{ font-family: &quot;verdana&quot;; font-size: 19px; color: black; font-weight: bold !important; line-height: 1 !important; } } </style> <code............>............</code> <style type="text/css"> </style> <code............>............</code> bla blah bla blah bla blah <style type="text/css"></style> <code............>............</code> <style type="text/css"> code { font-family: &quot;verdana&quot;; font-size: 19px; color: black; font-weight: bold !important; line-height: 1 !important; } } </style> bla blah <code............>............</code> A lot of text here, spanning many lines <style type="text/css"> code { font-family: &quot;verdana&quot;; font-size: 19px; color: black; font-weight: bold !important; line-height: 1 !important; } } </style> Some text/codes here <div id="google_translate_element"></div> <script type="text/javascript"> Some javascript here </script> <code............>............</code> A lot of text here, spanning many lines <style type="text/css"> </style> Some text/codes here <div id="google_translate_element"></div> <script type="text/javascript"> Some javascript here </script> BR guy038
    • rafaelloR

      Awesome Notepad++ Configs, settings and syntax highlighting

      Watching Ignoring Scheduled Pinned Locked Moved Notepad++ & Plugin Development
      7
      3
      0 Votes
      7 Posts
      333 Views
      PeterJonesP
      @rafaello , IANAL, and I don’t own the trademark, but with your clarifications and updates, I believe you’re probably not violating the trademark (IMO). It’s good to see someone who is willing to accept such feedback (rather than digging in your heels for a while, like happened with the aforementioned fork).
    • guy038G

      Generic Regex : How to use the couple of "Backtracking Control" verbs (*SKIP)(*FAIL) or (*SKIP)(*F) in regexes

      Watching Ignoring Scheduled Pinned Locked Moved Blogs
      9
      4 Votes
      9 Posts
      4k Views
      dr ramaanandD
      Another example can be seen at https://community.notepad-plus-plus.org/topic/27601/with-the-help-of-a-regex-how-to-find-code-preceded-by-a-only-if-code-is-absent-between-style-and-style-in-the-css-section-which-is-below/4