Community
    • Login

    Find words stuck to a bracket or parenthesis but skip those in the CSS and meta tags

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    13 Posts 2 Posters 393 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • dr ramaanandD
      dr ramaanand
      last edited by

      Block of original text for testing:-

      <!DOCTYPE html>
      <html lang="en">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge">
      <META name="viewport" content="width=device-width, initial-scale=1">
      <title>Homeopathic medicine, Homeopathic remedies, ACONITUM NAPELLUS</title>
      <META name="description" content="ACONITUM NAPELLUS">
      <META name="keywords" content="Homeopathic medicine Bangalore, Homeopathic remedies Bangalore, ACONITUM NAPELLUS">
      <META name="robots" content="index, follow" />
      
      <META name="google-site-verification" content="B5jrpKjfHEj--_J-rT51c3CG8zg1sY_ZRQAbqQ1oN5Q">
      <link href="css/style.css" rel="stylesheet" type="text/css" media="all">
      <link href="https://www.cure4incurables.in/css/bootstrap.min.css" rel="stylesheet">
      <link href="https://www.cure4incurables.in/css/style1.css" rel="stylesheet">
      <link href="css/style.css" rel="stylesheet" type="text/css" media="all">
      <link rel="stylesheet" type="text/css" href="engine1/style.css" media="screen">
      <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
      </head>
      <body style="color: rgb(0, 0, 0);" alink="#ee0000" link="#0000ee" vlink="#551a8b">
      <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --><!-- Bootstrap --><!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --><!-- WARNING: Respond.js doesn't work if you view the page via file:// --><!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
      <![endif]-->&nbsp;
      <!-- Start WOWSlider.com HEAD section --><!-- End WOWSlider.com HEAD section --><!--body wrapper-->
      <div class="container">
      <div class="container1">
      <div class="sticky"> Bangalore based polyclinic offering
      treatments in modern medicine, homoeopathy, ayurveda, naturopathy,
      hypnotherapy, healing and meditation, etc. </div>
      <!--navigation --><nav class="navbar navbar-default"><!-- Brand and toggle get grouped for better mobile display -->
      <div class="row">
      <div class="navbar-header"><!-- a class="navbar-brand" href="index.html" --><!-- Collect the nav links, forms, and other content for toggling --><a class="navbar-brand" href="index.html" style="text-decoration: none; color: rgb(46, 150, 226);"><img src="https://www.cure4incurables.in/images/logo.png" alt="Logo" class="responsive"></a></div><!-- div class="collapse navbar-collapse"
      id="bs-example-navbar-collapse-1" -->
      <!-- div class="container" -->
      <div><div class="translate" id="google_translate_element" style="text-align: right; margin-right: 0.2in;"><p class="translate" style="font-size: 15px; color: black; line-height: 18px; font-style: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; background-color: transparent; font-family: Verdana; text-align: right;"><strong><span style="color: blue;">ಭಾಷೆ ಬದಲಾಯಿಸಲು ಕೆಳಗೆ ಕ್ಲಿಕ್ ಮಾಡಿ:</span><br><span style="color: navy;">भाषा बदलने के लिए, नीचे क्लिक करें:-</span></strong>
      </p></div>
      <ul class="topnav" id="myTopnav" style="padding: 0px; margin-left: 0.2in; margin-right: 0.2in; list-style-type: none; list-style-image: none; list-style-position: outside; vertical-align: middle; font-family: &quot;Segoe UI&quot;; font-size: 16px; background-color: #87cefa;">
      <li class="links"><a style="color: black;" href="#">Links:</a></li>
      <li class="links"><a style="color: black;" href="index.html">Home</a></li>
      <li class="links"><a style="color: black;" href="About-a-cure-for-incurables-clinic.html">About Us</a></li>
      <li class="links"><a style="color: black;" href="Our-Services.html">Our Services</a></li>
      <li class="links"> <a style="color: black;" href="homeopathy-treatment.html">Homeopathy</a></li>
      <li class="links"><a style="color: black;" href="testimonials.html">Testimonials</a></li>
      <li class="links"><a style="color: black;" href="Biz-Offers.html">Biz Offers</a></li>
      <li class="links"><a style="color: black;" href="Contact-Us.html">Contact Us</a></li>
      <li class="links"><a style="color: black;" href="enquiry.html">Enquiry</a></li>
      <!--</li> --><li class="icon">
      <a style="margin-top: -5px;" href="#" id="toggle"><big><big>&#x25BC;</big></big></a></li></ul></div></div>  </nav><!-- /.navbar-collapse --><!-- /.container-fluid --><!-- /.nav --><!--Header Ends--><!--body content-->
      <div style=""><!--slider-->
      <div id="carousel-example-generic" class="carousel slide" data-ride="carousel"><!-- Indicators --><!-- Wrapper for slides -->
      <div class="carousel-inner"></div>
      <!-- Controls --></div>
      <!-- end slider--><br>
      <!-- div id="container" -->
      <div id="right"><!-- div class="row add-top" --><!-- div class="col-md-9 col-sm-9" --><!-- div class="bodycont" --><!-- div class="body-right" --><!-- div class="bodycont" -->
      <div class="quickcontact"><!-- div class="body-right" --><!-- div class="body-right-title" -->
      <div class="row add-top">
      <div class="col-md-9 col-sm-9">
      <div class="bodycont">
      <h1>ACONITUM NAPELLUS [Acon]</h1>
      <p style="color: black; font-family: Verdana,sans-serif; font-size: 18px; font-style: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; display: inline ! important; float: none;">ACONITUM NAPELLUS uses [Acon uses]</p>
      <p class=MsoNormal><span style='font-size:13.5pt;line-height:115%;font-family:
      "Verdana","sans-serif";color:black;mso-themecolor:text1'>Note: Wherever it is found, &quot;&lt;&quot; denotes aggravation (worse by), &quot;&gt;&quot; denotes amelioration (better by), &quot;&lt;-&gt;&quot; denotes alternation (alternates with) and A/F is an abbreviation of, &quot;Ailments from&quot;</span>
      </p>
      <div style="margin-bottom:-15px;width:100%;background-color:#EBF4FB;">
      <p class=MsoNormal style='margin-bottom:12.0pt;line-height:normal'><span
        style='font-size:13.5pt;font-family:"Verdana","sans-serif";mso-fareast-font-family:
        "Times New Roman";mso-bidi-font-family:"Times New Roman";color:#075296'>Terror,
        anxiety, agonizing fear, restless, excited, nervous, impatient<br><br>
        Sudden, violently acute, painful effects. Congestions. Inflammation. Haemorrhages<br><br>
        Sticking, tearing pains with numbness. Burning thirst. High fever</span></p>
      </div>
      <div class="container">
         <div class="left">
        <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
        normal'><b><span style='font-size:13.5pt;font-family:"Verdana","sans-serif";
        mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman";
        color:red'>REMEDY RELATIONSHIPS</span></b>
      </p>
      </div>
      <div class="right">
        <p class=MsoNormal style='margin-bottom:0in;margin-bottom:.0001pt;line-height:
        normal'><b><span style='font-size:13.5pt;font-family:"Verdana","sans-serif";
        mso-fareast-font-family:"Times New Roman";mso-bidi-font-family:"Times New Roman";
        color:black'>Complements: </span></b><span style='font-size:13.5pt;
        font-family:"Verdana","sans-serif";mso-fareast-font-family:"Times New Roman";
        mso-bidi-font-family:"Times New Roman";color:black'>Arn, Coff, Sulph<br>
        <br>
        <b>Follows Well: </b>Ars, Bell, Bry, Calc, Hep, Ip, Lyc, Merc, Nux-v, Phos,
        Puls, Rhus, Sep, Spong<br>
        <br>
        <b>Compare: </b>Bell, Cann-i, Cham, Cocc, Con, Dulc<br>
        <br>
        <b>Antidoted By: </b>Acet-ac, Cham, Cimic, Coff, Nux-v, Par, Petr, Sep, Sulph(Brimstone)<br>
        <br>
        <b>It Antidotes: </b>Arn, Aspin, Astac, Bell, Bry, Cact, Canth, Cham, Chel,
        Cit-v, Coff, Croc, Dol, Glon, Graph, Kalm, Kreos, Lyc, Merc-p, Mez, Morph,
        Nux-v, Petr, Sep, Sol, Spong, Stry, Sulph, Ther, Verat, Vib-p</span>
      </p>
        </td>
         </tr>
      </table>
      </div>
      </div>
      </div>
      </div>
      <div class="col-md-3 col-sm-3">
      <div class="bodycont">
      <div class="quickcontact">
      <h6>Specializations</h6>
      <ul class="list-unstyled">
      <li><a href="modern-medicine.html" title="Modern Medicine| Modern Medicine Bangalore">Modern
      Medicine</a></li>
      <li> <a href="homeopathy-treatment.html" title="Homeopathy treatment| Homeopathy treatment Bangalore">Homeopathy treatment</a>
      </li>
      <li><a href="homeopathy-doctor.html" title="Homeopathy Doctor| Homeopathy Doctor Bangalore">Homeopathy Doctor</a></li>
      <li>  <a href="6_Cancer.html" title="Homeopathy Cancer| Homeopathy Cancer Bangalore">Cancer</a></li>
      <li><a href="hiv-aids.html" title="Homeopathy HIV AIDS| Homeopathy HIV AIDS Bangalore">HIV / AIDS</a></li>
      <li><a href="ayurveda.html" title="Ayurveda| Ayurveda Bangalore">Ayurveda</a></li>
      <li><a href="naturopathy.html" title="Naturopathy| Naturopathy Bangalore">Naturopathy</a>
      </li>
      <li><a href="hypnotherapy.html" title="Hypnotherapy| Hypnotherapy Bangalore">Hypnotherapy</a>
      </li>
      <li><a href="Meditation.html" title="Meditation| Meditation Bangalore">Meditation</a></li>
      </ul>
      <div class="quickcontact">
      <h6>Remedies A-Z</h6>
      </div>
      <div style="margin: 2px; overflow: scroll; height: 275px; padding-top: 2px;"><!-- div id="collapse1" class="panel-collapse collapse" -->
      <ul class="list-unstyled">
      <li><a href="Abies-Canadensis.html">Abies
      Canadensis</a></li>
      <li><a href="Abies-Nigra.html">Abies Nigra</a></li>
      <li><a href="Abrotanum.html">Abrotanum</a></li>
      <li><a href="Acalypha-Indica.html">Acalypha
      Indica</a></li>
      <li><a href="Aceticum-Acidum.html">Aceticum
      Acidum</a></li>
      <li><a href="ACONITUM-NAPELLUS.html">Aconitum
      Napellus</a></li>
      </ul>
      </div>
      <div class="quickcontact">
      <h6>Diseases &amp; Conditions</h6>
      </div>
      <div style="margin: 2px; overflow: scroll; height: 275px; padding-top: 2px;">
      <ul class="list-unstyled">
      <li><a href="acne.html">Acne or Pimples</a></li>
      <li><a href="pimples.htm">Zits</a></li>
      </ul>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      <!-- end wrapper--><!--body content ends--><!--footer-->
      <div class="clear"></div>
      <br><footer style="width: 100%; height: auto;" class="panel-footer footer add-top">
      <div style="width: 100%; height: auto;" class="container"><div style="width: 100%; height: auto; background-color: transparent;" class="col-md-12 col-sm-12"><a href="index.html"> Home</a>
      |<a href="About-a-cure-for-incurables-clinic.html">
      About Us</a>|<a href="101_Dr.Ramanand-j-v.html"> Dr
      Ramaanand</a> |<a href="Our-Services.html"> Our
      Services</a>| <a href="homeopathy-doctor.html"> Homeopathy Doctor</a> | <a href="Homeopathy-clinic.html"> Homeopathy Clinic</a> |<a href="testimonials.html">
      Testimonials</a> |<a href="homoeopathy.html"> Homoeopathy</a> | <a href="defending-homeopathy.html">
      Defending Homeopathy</a> |<a href="Biz-Offers.html"> Biz
      offers</a>
      |<a href="Contact-Us.html">
      Contact Us</a></div>
      </div>
      </footer>
      <div class="footer-btm">
      <div class="container">
      <div class="col-md-12 col-sm-12 text-center"> A Cure for
      Incurables Clinic &copy; 2009-2024 | All Rights Reserved.</div>
      </div>
      </div>
      <!-- to top--><a href="#" class="cd-top">Top</a>
      <button class="button-top"><i class="fa fa-chevron-up"></i></button>
      <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
      <!-- Include all compiled plugins (below), or include individual files as needed -->
      <script src="js/bootstrap.min.js"></script>
      <script src="js/backtotop.js"></script>
      <script type="text/javascript" src="js/function.js"></script>
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
      <style type="text/css">
      p.translate {
        display: none;}
      @media only screen
        and (min-width : 320px) and (max-width : 861px){
          p.translate { display: inline; }
      }
      ul.topnav {
        list-style-type: none;
        margin: 0;
        padding: 6px;
        overflow: hidden;
        background-color: #87cefa;
      }
        ul.topnav li {
        float: left;
      }
      ul.topnav li a {
        display: inline-block;
        color: #f2f2f2;
        text-align: center;
        padding: 0px 3px;
        text-decoration: none;
        transition: 0.3s;
        font-size: 16px;
      }
      ul.topnav li a:hover {
        background-color: #0000FF;
        color: white !important;
      }
      ul.topnav li.icon {
        display: none;
      }
      @media screen and (max-width:1180px) {
        ul.topnav li:not(:first-child) {
          display: none;
        }
        ul.topnav li.icon {
          float: left;
          display: inline-block;
        }
      }
      @media screen and (max-width:680px) {
        div.translate {
          margin-top: 3%;
        }
        ul.topnav.responsive {
          position: relative;
        }
        ul.topnav.responsive li.icon {
          position: absolute;
          right: 0;
          top: 0;
        }
        ul.topnav.responsive li {
        float: none;
        display: inline;
        }
        ul.topnav.responsive li a {
        display: block;
        text-align: left;
        }
      }
      .button-top {
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 100;
        width: 40px;
        height: 40px;
        border: 0;
       
      border-radius: 2px;
        box-shadow: none;
        background: rgba(0, 196, 242, 0.3);
        color: white;
        font-size: 26px;
        line-height: 20px;
        text-align: center;
        cursor: pointer;
      }
      .button-top {
        ...previous code
        pointer-events: none;
        opacity: 0;
        transition: opacity .18s ease;
      }
      .button-top-visible {
        opacity: 1;
        pointer-events: auto;
      }
      ul.list-unstyled li {
        font-size: 16px;
      }
      .table_wrapper {
        display: block;
        width: max-content;
        max-width: 100%;
        overflow: auto;
        resize: horizontal;
        border: 0px solid black;
      }
      @media screen and (max-width: 600px) {
        p.translate {
          display: inline;
        }
      }
      .container {
          display: flex;
      }
      .container > div {}
      }
      .left {
        width: 150px;
        border-width:1px;
        border-style:solid;
        border-color:lightblue;
        padding-top:10px;
      }
      .right {
        width: 150px;
        border-width:1px;
        border-style:solid;
        border-color:lightblue;
      }
      @media (max-width: 480px) {
      .left {
        width: 150px;
        border-width:1px;
        border-style:solid;
        border-color:lightblue;
        padding-top:10px;
      }
      .right {
        width: 145px;
        border-top:1px solid lightblue;
        li {
          margin-left: -30px;
        }
        li div.marginleft {
          margin-left: -6px;
        }
      }
      }
      @media (min-width: 481px) and (max-width: 767px) {
      .left {
        width: 175px;
        border-width:1px;
        border-style:solid;
        border-color:lightblue;
        padding-top:10px;
      }
      .right {
        width: 250px;
        border-width:1px;
        border-style:solid;
        border-color:lightblue;
      }
      }
      @media (min-width: 768px) and (max-width: 1024px) {
      .left {
        width: 180px;
        border-width:1px;
        border-style:solid;
        border-color:lightblue;
        padding-top:10px;
      }
      .right {
        width: 360px;
        border-width:1px;
        border-style:solid;
        border-color:lightblue;
      }
      }
      @media (min-width: 1025px) and (max-width: 1280px) {
      .left {
        width: 180px;
        border-width:1px;
        border-style:solid;
        border-color:lightblue;
        padding-top:10px;
      }
      .right {
        width: 520px;
        border-width:1px;
        border-style:solid;
        border-color:lightblue;
      }
      }
      @media (min-width: 1281px) {
      .left {
        width: 180px;
        border-width:1px;
        border-style:solid;
        border-color:lightblue;
        padding-top:10px;
      }
      .right {
        width: 560px;
        border-width:1px;
        border-style:solid;
        border-color:lightblue;
        margin-top:0px;
      }
      }
      </style>
      <script>
      $(function() {
        $('.links').on("click", function() {
          $("#myTopnav").removeClass("responsive");
        });
        $("#toggle").on("click", function() {
          const $nav = $("#myTopnav");
          $nav.toggleClass("responsive");
          $(this).html(
            $nav.hasClass("responsive") ?  "<big><big>&#x2715;</big></big>" : "<big><big>&#x25BC;</big></big>"
          )
        });
      });
      </script>
      <div id="google_translate_element"></div>
      <script type="text/javascript">
      function googleTranslateElementInit() {
        new google.translate.TranslateElement({pageLanguage: 'en'}, 'google_translate_element');
      }
      </script>
      <script>
      jQuery(function ($) {
        var $window = $(window);
        var $buttonTop = $('.button-top');
        $buttonTop.on('click', function () {
          $('html, body').animate({
            scrollTop: 0,
          }, 400);
        });
        $window.on('scroll', function () {
          if ($window.scrollTop() > 300) { // 300 is our threshold in pixels
            $buttonTop.addClass('button-top-visible');
          } else {
            $buttonTop.removeClass('button-top-visible');
          }
        });
      });
      </script>
      <script type="text/javascript" src="https://translate.google.com/translate_a/element.js?
      cb=googleTranslateElementInit">
      </script>
      <script type="text/javascript" src="engine1/jquery.js"></script>
      </div>
      </div>
      </div>
      </div>
      </div>
      </div>
      </body>
      </html>
      
      dr ramaanandD 1 Reply Last reply Reply Quote 0
      • dr ramaanandD
        dr ramaanand @dr ramaanand
        last edited by

        I tried this regular expression which selects everything instead of selecting just what I want, that is to find words stuck to a bracket or parenthesis but skip those in the CSS section and meta tags: (?x)(<html[\S\s]*?<\/h1>)(*SKIP)(*F)|(<p[^>]*>[\S\s]*?uses\]<\/p>)(*SKIP)(*F)|(<[\S\s]*?>)(*SKIP)(*F)|(E-mail)(*SKIP)(*F)|(<h6[^<>]*>.*?<\/h6>)(*SKIP)(*F)|(A-Z)(*SKIP)(*F)|(<a\s[^>]*href.*?<\/a>)(*SKIP)(*F)|(2009-2024)(*SKIP)(*F)|(<style[\S\s]*?<\/style>)(*SKIP)(*F)|(<script[\S\s]*?<\/script>)(*SKIP)(*F)|\w+\(

        dr ramaanandD 2 Replies Last reply Reply Quote 0
        • dr ramaanandD
          dr ramaanand @dr ramaanand
          last edited by dr ramaanand

          At regex101.com, it finds 21 matches [although, if it skips what is in the CSS section and meta tags, it should find just one match - Sulph(Brimstone)] - see https://regex101.com/r/h9S2PI/1 but on Notepad++, it selects everything from the top to the bottom instead of skipping what I want it to

          1 Reply Last reply Reply Quote 0
          • dr ramaanandD
            dr ramaanand @dr ramaanand
            last edited by

            @dr-ramaanand said in Find words stuck to a bracket or parenthesis but skip those in the CSS and meta tags:

            (<style[\S\s]*?</style>)(*SKIP)(F)|(<script[\S\s]?</script>)(*SKIP)(*F)|

            does not seem to skip what is between <style............ and <\/style>) and what is between <script............ and <\/script>)

            1 Reply Last reply Reply Quote 0
            • Mark OlsonM
              Mark Olson
              last edited by

              @dr-ramaanand
              First of all, this seems like a really obvious use case for an XML parser and not regular expressions (even more so than other examples where people are trying to parse XML with regex). Just parse the XML, recursively search the elements, and extract words in a bracket or parenthesis only if the tag name is not CSS or meta. Yes, I know you’re not going to listen to me because nobody ever listens to me when I give this recommendation, but I’m going to keep banging my head against that wall because I know I’m right.

              I’m not going to try to analyze your regexes because they’re godawful unhinged enormous monstrosities that should really be making you reconsider your life choices, but I have a more meta question for you: is there any particular reason why you’re doing x(*SKIP)(*F)|y(*SKIP)(*F)|z(*SKIP)(*F)|a instead of the more concise (?:x|y|z)(*SKIP)(*F)|a ?

              dr ramaanandD 1 Reply Last reply Reply Quote 1
              • dr ramaanandD
                dr ramaanand @Mark Olson
                last edited by dr ramaanand

                @Mark-Olson Sorry, there is nothing in common to club either the first string or the last string

                dr ramaanandD 1 Reply Last reply Reply Quote 0
                • dr ramaanandD
                  dr ramaanand @dr ramaanand
                  last edited by dr ramaanand

                  @Mark-Olson The regular expression (?:<html[\S\s]*?<\/h1>|<p[^>]*>[\S\s]*?uses\]<\/p>|<[\S\s]*?>|<style[^<>]*>[\S\s]*?<\/style>|<script[^<>]*>[\S\s]*?<\/script>)(*SKIP)(*F)|\w+\( also finds 21 matches, without skipping what is between <style......> and </style> and <script......> and </script> in the block for testing typed at the top

                  dr ramaanandD Mark OlsonM 2 Replies Last reply Reply Quote 0
                  • dr ramaanandD
                    dr ramaanand @dr ramaanand
                    last edited by

                    @Mark-Olson (?:<html[\S\s]*?<\/h1>|<p[^>]*>[\S\s]*?uses\]<\/p>|<[\S\s]*?>|style[^>]*>[^<>]*<\/style>|script[^>]*>[^<>]*<\/script>)(*SKIP)(*F)|\w+\( is an invalid expression

                    dr ramaanandD 1 Reply Last reply Reply Quote 0
                    • dr ramaanandD
                      dr ramaanand @dr ramaanand
                      last edited by dr ramaanand

                      @Mark-Olson (?:<html[\S\s]*?<\/h1>|<p[^>]*>[\S\s]*?uses\]<\/p>|<[\S\s]*?>|style[^>]*>[^<>][\S\s]*<\/style>|script[^>]*>[^<>][\S\s]*<\/script>)(*SKIP)(*F)|\w+\( skips what is between <style......> and </style> but not what is between <script......> and </script> - can you tweak that regular expression to skip what comes between <script......> and </script> ?

                      1 Reply Last reply Reply Quote 0
                      • Mark OlsonM
                        Mark Olson @dr ramaanand
                        last edited by

                        @dr-ramaanand said

                        @Mark-Olson The regular expression some...unhinged...monstrosity also finds 21 matches, blah blah blah

                        You misunderstood me. (?:x|y|z)(*SKIP)(*F)|a is exactly equivalent to x(*SKIP)(*F)|y(*SKIP)(*F)|z(*SKIP)(*F)|a except that it’s shorter. My proposal wasn’t trying to make your regex more correct, it was just trying to make it shorter without making it less correct.

                        @dr-ramaanand said

                        please help me

                        another request

                        yet another request

                        Look, please stop mentioning me. I am unfollowing this post because it’s cognitively draining just reading it. I’m done trying to help you with regular expressions. You are trying to use a hammer (regular expressions) to solve a problem that requires a screwdriver (XML). XML is a recursive data structure or context free language (for example, a div can contain a div, which can contain another div, and on and on and on…), and regular expressions are not suitable for such languages. Technically Notepad++'s Boost regex flavor can be used to handle such languages, but making a Notepad++ regex that properly handles all the subtleties of XML would make you cry tears of blood.

                        You are going to have a miserable time working with XML (and its little brother, HTML) until you learn how to use a real scripting language like Python. This is your final warning. I’m not trying to punish you, just trying to preserve my own sanity.

                        dr ramaanandD 1 Reply Last reply Reply Quote 3
                        • dr ramaanandD
                          dr ramaanand @Mark Olson
                          last edited by dr ramaanand

                          This RegEx (?:<html[\S\s]*?<\/h1>|<p[^>]*>[\S\s]*?uses\]<\/p>|<[\S\s]*?>|style[^>]*>[^<>][\S\s]*<\/script>)(*SKIP)(*F)|\w+\( seems fine. It finds every word stuck to a simple/round bracket or parenthesis to its right but skips what comes between the <html........</h1>, <p...... uses]</p>, <.........>, as well as style.......... </script>

                          dr ramaanandD 1 Reply Last reply Reply Quote 0
                          • dr ramaanandD
                            dr ramaanand @dr ramaanand
                            last edited by

                            Sorry, the Regular expression (?:<html[\S\s]*?<\/h1>|<p[^>]*>[\S\s]*?uses\]<\/p>|<[\S\s]*?>|style[^>]*>[^<>][\S\s]*<\/script>)(*SKIP)(*F)|\w+\( finds every word stuck to a simple/round bracket or parenthesis to its right but skips what comes between the <html........ and </h1>, <p...... and uses]</p>, <......... and >, as well as style.......... and </script>

                            dr ramaanandD 1 Reply Last reply Reply Quote 0
                            • dr ramaanandD
                              dr ramaanand @dr ramaanand
                              last edited by

                              On using the above RegEx, in 80 files out of 300 files in a folder, the whole text of the file was selected, instead of just a word stuck to a simple, round bracket/parenthesis to its right. Is it because no such words were found in the file (only 2 such words were found in two different files)?

                              1 Reply Last reply Reply Quote 0
                              • First post
                                Last post
                              The Community of users of the Notepad++ text editor.
                              Powered by NodeBB | Contributors