Loading ...
Sorry, an error occurred while loading the content.

Dot matches newline ON or OFF (was Re: Non printing characters.)

Expand Messages
  • kahitch
    OK: You guys are going to think I m utterly daft. I swear, this clip has been working just *fine* for years. Now...now, it s replacing the regexed content
    Message 1 of 16 , Apr 18, 2013
    • 0 Attachment
      OK:

      You guys are going to think I'm utterly daft. I swear, this clip has been working just *fine* for years. Now...now, it's replacing the regexed content WITH this, exactly: <i>$1</i> Not the saved content; the bloody $1 itself. I've tried parentheses, of course; I feel like I've dropped into some alternate reality.

      Did 7.01 change something, and I missed it? I don't regex as much as I used to, because I run the company and I'm mostly doing admin. But no kidding, I've used that regex without a hitch (no pun) for ages. The line wrapping help helped (TY!), but now...the replace has gone wonk.

      If there's something I need to read, that will tell me why my clip has gone bananas, can someone point me at it? Did I somehow screw up a setting? Any ideas? Thank you.

      Hitch


      --- In ntb-clips@yahoogroups.com, hitch@... wrote:
      >
      >
      >
      > Thanks--for everything. The inadvertent email, etc.
      >
      > What's bugging me is: I've used the originally stated clip for ...2-3 years. There's no WAY that every time I used it, the content contained between the spans didn't have non-printing chars. No WAY. So...does anyone have any ideas as to why it would have worked fine for the last few years--just as shown--and now not work due to the np chars? That's what's getting me nuts...
      >
      > Thanks for the regex, too. I really hardly ever pull out RB, as (I hate to admit this), it mostly confuses me. I find the interface difficult. I usually bang around in NTPro until I figure something out, mostly because I'm dense that way. ;-) I'll give yours a go and see how it rolls--Txs again. (Leaving the quoted bits for anyone else who comes along...)
      >
      > Hitch
      > Who is NOT emailing this to anyone directly, TYSM.
      >
    • Axel Berger
      ... Which clip? Axel
      Message 2 of 16 , Apr 18, 2013
      • 0 Attachment
        hitch@... wrote:
        > this clip

        Which clip?

        Axel
      • kahitch
        Hi,Axel: Once upon a time, this clip, modified as needed inside the opening search spans with the named whatevers: Search: (.*?) Replace:
        Message 3 of 16 , Apr 19, 2013
        • 0 Attachment
          Hi,Axel:

          Once upon a time, this clip, modified as needed inside the opening search spans with the named whatevers:

          Search: <italic span>(.*?)</span> Replace: <i>$1</i>

          Worked *perfectly* to replace named spans intended to create italics, in an HTML file, with the regular html i tags. I posted here some days ago because abruptly (and this clip has been stored in my library for ~2 years now), it stopped working whenever it encountered line wrapping within the (.*?) content. Another poster kindly gave me a leg up by giving me a reminder to use (?s), before the search, and that solved the wrapping issue, but then, all of a sudden, the replace was actually putting <i>$1</i> in, not <i>stored content</i>. In other words, it was replacing the original content with $1 itself. Yes, I have regex checked; yes, I tried putting parens around the $1 (always my first go-to--try parentheses). ;-)

          Now...usually, when my regex is wonky, I assume it's me, because, to borrow from the idiot Ricin guy, I ain't no "Mensa Expert" about Regex. I even have Regex Buddy (with which I struggle), mostly due to the UI, more than the logic. But this clip has worked for years, sans any alteration. I just...I just don't get why suddenly, it's stopped working, first on one front, now on the other. I'm...boggled.

          I haven't used Regex extensively since installing 7.01. Did I miss something along the way? Some change that would account for this?

          Thx.
          Hitch


          --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
          >
          > hitch@... wrote:
          > > this clip
          >
          > Which clip?
          >
          > Axel
          >
        • Axel Berger
          ... As above it s no clip. When using those two terms in the dialogue you need to select regular expressions. There was a recent change there, regex used to be
          Message 4 of 16 , Apr 19, 2013
          • 0 Attachment
            hitch@... wrote:
            > Search: <italic span>(.*?)</span> Replace: <i>$1</i>

            > this clip has been stored in my library for ~2 years now

            As above it's no clip. When using those two terms in the dialogue you
            need to select regular expressions. There was a recent change there,
            regex used to be a checkbox and is now part of a dropdown.

            If it is a clip please post that as-is and completely and not some
            decription of it.

            Axel
          • John Shotsky
            It is also helpful to provide an actual section of sample text that you are working with. Sometimes, the regex doesn t work because the text isn t exactly as
            Message 5 of 16 , Apr 19, 2013
            • 0 Attachment
              It is also helpful to provide an actual section of sample text that you are working with. Sometimes, the regex doesn't work because
              the text isn't exactly as described. A description of text isn't very useful if you want help, because anyone that wants to help
              must create that text for themselves using your description, which may NOT be what is being worked with. Your search term as written
              needs to escape the slash in /span, for one problem.

              If it was a working clip, nothing should have changed its operation in version 7.x.

              Regards,
              John
              RecipeTools Web Site: <http://recipetools.gotdns.com/> http://recipetools.gotdns.com/
              John's Mags Yahoo Group: <http://groups.yahoo.com/group/johnsmags/> http://groups.yahoo.com/group/johnsmags/

              From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Axel Berger
              Sent: Friday, April 19, 2013 05:25
              To: ntb-clips@yahoogroups.com
              Subject: Re: [Clip] Dot matches newline ON or OFF (was Re: Non printing characters.)


              hitch@... <mailto:hitch%40booknook.biz> wrote:
              > Search: <italic span>(.*?)</span> Replace: <i>$1</i>

              > this clip has been stored in my library for ~2 years now

              As above it's no clip. When using those two terms in the dialogue you
              need to select regular expressions. There was a recent change there,
              regex used to be a checkbox and is now part of a dropdown.

              If it is a clip please post that as-is and completely and not some
              decription of it.

              Axel



              [Non-text portions of this message have been removed]
            • Axel Berger
              ... Actually it doesn t, as the forward slash is no metacharacter. But as ... I only escape where strictly necessary, which means I tend to forget. Axel
              Message 6 of 16 , Apr 19, 2013
              • 0 Attachment
                John Shotsky wrote:
                > Your search term as written
                > needs to escape the slash in /span, for one problem.

                Actually it doesn't, as the forward slash is no metacharacter. But as
                the help file states:

                > This escaping action applies whether or not the following character
                > would otherwise be interpreted as a metacharacter, so it is always
                > safe to precede a non-alphanumeric with backslash to specify that
                > it stands for itself.

                I only escape where strictly necessary, which means I tend to forget.

                Axel
              • kahitch
                Axel: I posted the description, so you d know what I did as it was being entered. I did not realize that what I d pasted would be unclear to anyone here. To
                Message 7 of 16 , Apr 19, 2013
                • 0 Attachment
                  Axel:

                  I posted the description, so you'd know what I did as it was being entered. I did not realize that what I'd pasted would be unclear to anyone here. To be clear, in the "search for" field, I used:

                  <italic span>(.*?)</span>

                  With the named span inserted where the "italic span" text is now. When I say that this is a 'clip,' I keep it stored in my clips, but as it's never the same (the name and other material for the span can be ANYTHING that somebody in their brain thought up, any name for the span, any font, etc.), it's not viable as a regular "clip." I mean, I could automate it, to the pasting, but...why?

                  So, I copy-and-paste the name of the span, e.g.:

                  <span style='font-family:"Times New Roman Italic","serif"'>(.*?)</span>

                  then select regex, and then, in the replace box, I've simply always put:

                  <i>$1</i>

                  ...which has, to date, *always* worked. Now, I know that I've got "regex" selected, because it's finding the FIND. If regex were not selected, it would not be. After a post here, I added

                  (?s)

                  to the front of the search, as I was suddenly encountering issues with the search not working due to non-printing chars. (This has always worked, non-printing chars or not, before, BTW, without the (?s), FWIW).

                  And NOW, the replace is replacing what *should* be something like

                  <i>and they lived happily ever after</i>

                  post-regex, to:

                  <i>$1</i>

                  literally. As if it's a regular s&r, not regex. Yes, I tried putting parentheticals around the $1, but that did not change the result.

                  Does anyone have any thoughts? Thank you.

                  Hitch


                  --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
                  >
                  > hitch@... wrote:
                  > > Search: <italic span>(.*?)</span> Replace: <i>$1</i>
                  >
                  > > this clip has been stored in my library for ~2 years now
                  >
                  > As above it's no clip. When using those two terms in the dialogue you
                  > need to select regular expressions. There was a recent change there,
                  > regex used to be a checkbox and is now part of a dropdown.
                  >
                  > If it is a clip please post that as-is and completely and not some
                  > decription of it.
                  >
                  > Axel
                  >
                • John Shotsky
                  The first thought is to post the text you are working with, as previously mentioned. We aren t going to build your test case FOR YOU. If you want help, be
                  Message 8 of 16 , Apr 19, 2013
                  • 0 Attachment
                    The first thought is to post the text you are working with, as previously mentioned. We aren't going to build your test case FOR
                    YOU. If you want help, be SPECIFIC.

                    Your 'example' shows a number of characters that can't be used in regex without escaping them, and as they are, and that would NEVER
                    have worked. Specifically, if you have double quotes in the find, you have to escape them. Still, you have not made it clear what
                    you are doing, since there is no block of your target text and no clear example of your find/replace text. Almost ALL of us can make
                    it work, but you are trying to make us guess what your text looks like.

                    Regards,
                    John
                    RecipeTools Web Site: <http://recipetools.gotdns.com/> http://recipetools.gotdns.com/
                    John's Mags Yahoo Group: <http://groups.yahoo.com/group/johnsmags/> http://groups.yahoo.com/group/johnsmags/

                    From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of hitch@...
                    Sent: Friday, April 19, 2013 17:19
                    To: ntb-clips@yahoogroups.com
                    Subject: [Clip] Dot matches newline ON or OFF (was Re: Non printing characters.)




                    Axel:

                    I posted the description, so you'd know what I did as it was being entered. I did not realize that what I'd pasted would be unclear
                    to anyone here. To be clear, in the "search for" field, I used:

                    <italic span>(.*?)</span>

                    With the named span inserted where the "italic span" text is now. When I say that this is a 'clip,' I keep it stored in my clips,
                    but as it's never the same (the name and other material for the span can be ANYTHING that somebody in their brain thought up, any
                    name for the span, any font, etc.), it's not viable as a regular "clip." I mean, I could automate it, to the pasting, but...why?

                    So, I copy-and-paste the name of the span, e.g.:

                    <span style='font-family:"Times New Roman Italic","serif"'>(.*?)</span>

                    then select regex, and then, in the replace box, I've simply always put:

                    <i>$1</i>

                    ...which has, to date, *always* worked. Now, I know that I've got "regex" selected, because it's finding the FIND. If regex were not
                    selected, it would not be. After a post here, I added

                    (?s)

                    to the front of the search, as I was suddenly encountering issues with the search not working due to non-printing chars. (This has
                    always worked, non-printing chars or not, before, BTW, without the (?s), FWIW).

                    And NOW, the replace is replacing what *should* be something like

                    <i>and they lived happily ever after</i>

                    post-regex, to:

                    <i>$1</i>

                    literally. As if it's a regular s&r, not regex. Yes, I tried putting parentheticals around the $1, but that did not change the
                    result.

                    Does anyone have any thoughts? Thank you.

                    Hitch

                    --- In ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com> , Axel Berger <Axel-Berger@...> wrote:
                    >
                    > hitch@... wrote:
                    > > Search: <italic span>(.*?)</span> Replace: <i>$1</i>
                    >
                    > > this clip has been stored in my library for ~2 years now
                    >
                    > As above it's no clip. When using those two terms in the dialogue you
                    > need to select regular expressions. There was a recent change there,
                    > regex used to be a checkbox and is now part of a dropdown.
                    >
                    > If it is a clip please post that as-is and completely and not some
                    > decription of it.
                    >
                    > Axel
                    >



                    [Non-text portions of this message have been removed]
                  • Axel Berger
                    ... That s what I assumed. Please accept that using the dialogue is NOT a clip. ... That one I don t quite get. You use the clipbook to store stuff which you
                    Message 9 of 16 , Apr 20, 2013
                    • 0 Attachment
                      hitch@... wrote:
                      > I did not realize that what I'd pasted would be unclear to anyone
                      > here. To be clear, in the "search for" field, I used:

                      That's what I assumed. Please accept that using the dialogue is NOT a
                      clip.

                      > When I say that this is a 'clip,' I keep it stored in my clips

                      That one I don't quite get. You use the clipbook to store stuff which
                      you then copy and paste into a dialogue? If you were to write

                      ^!Replace "<span[^>]*>(.*?)</span>" >> "<i>$1</i>" R

                      You could just click on that and be done.

                      > Now, I know that I've got "regex" selected, because it's finding
                      > the FIND. If regex were not selected, it would not be.

                      Yes, agree.

                      > Does anyone have any thoughts? Thank you.

                      I have to think about that one.

                      Axel
                    • Axel Berger
                      ... Alright, I ve done it. Using the dialogue like you do I have taken the Text: and they lived
                      Message 10 of 16 , Apr 20, 2013
                      • 0 Attachment
                        Axel Berger wrote:
                        > I have to think about that one.

                        Alright, I've done it. Using the dialogue like you do I have taken the

                        Text:
                        <span style='font-family:"Times New Roman Italic","serif"'>and they
                        lived happily ever after</span>

                        Find:
                        <span[^>]*>(.*?)</span>

                        Replace:
                        <i>$1</i>

                        and got:
                        <i>and they lived happily ever after</i>

                        I've no idea what may be wrong your side. But it has happened to all of
                        us, that we looked and looked and just did not see some embarrassing
                        typo or other. So as a general rule DO NOT type stuff into your mails
                        but always copy and paste even the simplest things. It MUST be something
                        simple and obvious, I just can't guess what it may be.

                        Axel
                      • kahitch
                        Axel: ... Without modifying the spanned aspect every time. The spans I fix are each completely different (to each document, not unique, all of them, to each
                        Message 11 of 16 , Apr 20, 2013
                        • 0 Attachment
                          Axel:

                          I'm no regex expert, and don't claim to be, but I cannot use this:

                          > ^!Replace "<span[^>]*>(.*?)</span>" >> "<i>$1</i>" R

                          Without modifying the spanned aspect every time. The spans I "fix" are each completely different (to each document, not unique, all of them, to each other). In word processing environments, each individual user (every single person) could name that span something completely different, use a different font, and have a different fallback font. Thusly, this span (which as been the subject of this discussion):

                          <span style='font-family:"Times New Roman Italic","serif"'>

                          Is unique ONLY to this particular document. Next time, it might be:

                          <span style='font-family:"Helvetica","sans-serif"'>

                          It's never the same information inside the span. In fact, because of the cruft that all the word-processing programs out there put out, I can have to make 3, 4 5 or more passes, because a) the spacing between elements or the text inside the span will be different; b) the name of the span will be different, or c) any number of other things will be different, all simply to do nothing more than simply *italicize text.* And this is in a single document.

                          And I cannot simply regex *all* the spans, because some goodly number of the spans--at least half--are legit, and shouldn't be removed or altered. Believe me, if the spans weren't different each and every time, OF COURSE I would create a clip that I could deploy with a click. I do have "actual" clips like that; those that replace curly quotes with straight, Fix apostrophes, etc. But that only works when the material searched for is always the same. In this case, not only is it not "always" the same, it is NEVER the same, and I don't have the luxury of nuking the precisely 3,937 instances of spans in the HTML document when only some 2-300 of them need to be changed.

                          And for the other posters: Yes, I've escaped the special characters. Here's a sample paragraph from the copyrighted text I've been working with:

                          <p class=BodyA style='margin-bottom:3.0pt;text-align:justify;text-indent:.25in'><span
                          style='font-family:"Times New Roman","serif"'>Emory told them about her long
                          day -- four photo shoots in three different locations, and one cranky baby who
                          threw up on her.  She found time to squeeze in an occasional text with Mason,
                          who was bothered by the tone of the Seahawks meeting -- he didn't like to be
                          doubted and hated having his divorce thrown in his face.  Wesley said that was
                          good news -- it was unlikely Mason would end up there -- but Emory couldn't
                          help thinking it was still a possibility.  </span><span style='font-family:
                          "Times New Roman Italic","serif"'>How would that work? </span><span
                          style='font-family:"Times New Roman","serif"'> </span></p>

                          The ONE span with the <span style='font-family:"Times New Roman Italic","serif"'> throughout the document, which occurs some several hundred times, is what I'm trying to change to, very simply, this:

                          <i>How would that work? </i>

                          But the clip that I have previously pasted here several times, which has previously worked without a hiccup, now does not. I have added the previously discussed bit, to resolve the non-printing characters, and, again, this is the "saved un-clip" that I've been using for two years sans issues, but now seems to have gone utterly wonky for no apparent reason (please infer that the "search" etc, are NOT part of the actual "clip," thank you); only what you see between opening and closing brackets is actually part of what goes in the regex search and replace boxes.

                          Search: <italic span>(.*?)</span> Replace: <i>$1</i>

                          Thank you. Again.

                          Hitch




                          --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
                          >
                          > hitch@... wrote:
                          > > I did not realize that what I'd pasted would be unclear to anyone
                          > > here. To be clear, in the "search for" field, I used:
                          >
                          > That's what I assumed. Please accept that using the dialogue is NOT a
                          > clip.
                          >
                          > > When I say that this is a 'clip,' I keep it stored in my clips
                          >
                          > That one I don't quite get. You use the clipbook to store stuff which
                          > you then copy and paste into a dialogue? If you were to write
                          >
                          > ^!Replace "<span[^>]*>(.*?)</span>" >> "<i>$1</i>" R
                          >
                          > You could just click on that and be done.
                          >
                          > > Now, I know that I've got "regex" selected, because it's finding
                          > > the FIND. If regex were not selected, it would not be.
                          >
                          > Yes, agree.
                          >
                          > > Does anyone have any thoughts? Thank you.
                          >
                          > I have to think about that one.
                          >
                          > Axel
                          >
                        • Axel Berger
                          ... Are those the same? What I tend to do in cases like that is to first mask the things I want to keep, by e.g. renaming to
                          Message 12 of 16 , Apr 20, 2013
                          • 0 Attachment
                            hitch@... wrote:
                            > And I cannot simply regex *all* the spans, because some goodly
                            > number of the spans--at least half--are legit, and shouldn't be
                            > removed or altered.

                            Are those the same? What I tend to do in cases like that is to first
                            mask the things I want to keep, by e.g. renaming to <xspan, alter
                            everything else, and rename my kept ones back.

                            > Believe me, if the spans weren't different each and every time,
                            > OF COURSE I would create a clip that I could deploy with a click.

                            I do believe you. But as stated I have replayed what you described as
                            exactly as I could and for me it worked flawlessly. Until I can
                            reproduce your problem I can't begin to think of a workaround. As John
                            said, give us a) a sample text, b) a find string, and c) a replace
                            string that don't work and thus reproduce your problem and we can begin
                            to concoct a solution.

                            Until that time all I can say is, it works as it should, I don't see
                            what your problem is. That is not doubting you that there is one, it's
                            just being incapable of reproducing it.

                            Axel
                          • Art Kocsis
                            ... Why is because (from what you have told us), it is a perfect application for a clip using RegEx. .* is exactly what ANYTHING that somebody in their
                            Message 13 of 16 , Apr 20, 2013
                            • 0 Attachment
                              At 4/19/2013 05:18 PM, Hitch wrote:
                              >With the named span inserted where the "italic span" text is now. When I say that this is a 'clip,' I keep it stored in my clips, but as it's never the same (the name and other material for the span can be ANYTHING that somebody in their brain thought up, any name for the span, any font, etc.), it's not viable as a regular "clip." I mean, I could automate it, to the pasting, but...why?
                              >
                              >So, I copy-and-paste the name of the span, e.g.:
                              >
                              ><span style='font-family:"Times New Roman Italic","serif"'>(.*?)</span>
                              >
                              >then select regex, and then, in the replace box, I've simply always put:
                              >
                              ><i>$1</i>


                              "Why" is because (from what you have told us), it is a perfect application for a clip using
                              RegEx. ".*" is exactly what "ANYTHING that somebody in their brain thought up" matches.

                              ^!Replace "(?s)<span\s[^>]*?>(.*?)</span>" >> "<i>$1</i>" IHRS

                              When you see a $n (n=digit), in the result it means the referenced capture substring is undefined. Note: a null string is still defined.


                              Now this is very strange!! The find works fine but the replace is going bananas.
                              The result of that command on your test line is:

                              <i>(.*?)</i>

                              The parenthesis meta characters are being treated as ordinary characters.

                              Stranger still (added alternate pattern and set min capture to 1):

                              ^!Replace "(?s)<span\s[^>]*?>(.+?|ZZZ)</span>" >> "<i>$1</i>" IHRS

                              Applied to (added "Z" between ">" and "("):

                              <span style='font-family:"Times New Roman Italic","serif"'>Z(.*?)</span>

                              Still results in:

                              <i>Z(.*?)</i>

                              OK, full debug mode (grouped tags & escaped ">"), group debug output.

                              Command (long line ahead followed by parenthesis verification):

                              ^!Replace "(?s)(<span\s[^>]*?\>)(.+?|ZZZ)(</span>)" >> "\r\n\$0='$0'\r\n\$1='$1'\r\n\$2='$2'\r\n\$3='$3'\r\n" IRST
                              ( )( )( | )( )

                              Test string:

                              <span style='font-family:"Times New Roman Italic","serif"'>Z(.*?)</span>

                              Command Results:

                              $0='<span style='font-family:"Times New Roman Italic","serif"'>Z(.*?)</span>'
                              $1='<span style='font-family:"Times New Roman Italic","serif"'>'
                              $2='Z(.*?)'
                              $3='</span>'

                              WIH is going on??? Same behavior with both NTS v5.8/fv & v6.2/fv.
                              Why is the (.*?) pattern not being treated as a group yet the other ones are?
                              This should have been a quick reply with a simple command the gremlins have attacked again.

                              Art
                            Your message has been successfully submitted and would be delivered to recipients shortly.