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

Can you please help???

Expand Messages
  • RudiV
    Hopefully, you folks are less arrogant than Julian, and allow me to have a pro-active exchange¡K As a retired IT guy of 35 years, knowing unix (realtime), I
    Message 1 of 4 , Nov 18, 2009
    • 0 Attachment
      Hopefully, you folks are less arrogant than Julian, and allow me to have a pro-active exchange¡K

      As a retired IT guy of 35 years, knowing unix (realtime), I never had much need to use Perl (though I could work SED faster than many folks using a GUI), the only syntax I know is SQL¡K So any help here is greatly appreciated in completing this project for my Grandson and his Buddies¡K

      Thanks in advance¡KRudi


      ¡§Hi Rudi,

      As explained in our documentation, our customer support service does not have the time resources to help you develop regular expressions.¡¨

      >>>
      Julian,

      This looks likes some very promising software for my use. I was able to get what I was trying to accomplish done, but it took a lot of extra time as I do not really know how to use your software yet. If the following can be accomplished; will need the example syntax from you folks, I will buy the Pro Version and learn the rest on my own.

      I¡¦ve attached a jpeg file of the data file I am trying to convert. My question below references this screen shot:

      (For this Message Board I¡¦ve converted the jpeg to text, I hope there are some smatter folks here than at Fookes¡¦s Tech-Support, they do not seem to want to attract or hold new customers ƒº)
      >>>>

      Jpeg converted to text:

      line 1: <?xml version="1.0" encoding="ISO-8859-1" standalone="yes" ?>
      line 2: <cardset setname="5D's Starter Deck 2009"
      line 3: releasedate="2009-06-09"
      line 4: card_count="43">
      line 5: <card id="5DS2-EN001"
      line 6- name="Gogiga Gagagigo"
      passcode="39674352"
      type="Normal Monster"
      monster_type="Reptile"
      attribute="Water"
      level="8"
      attack="2950"
      defense="2800"
      rarity="Common">
      <card_text>His soul long-since collapsed, his body recklessly continues onward, driven by a lust for more power. He no longer resembles his former self....</card_text>
      </card>
      Line etc: </cardset>
      >>>>


      I had to do the Replace option in 3 steps: as I could not figure out how to embed the CRLF and the end of each line into the find command)

      1) Line 2 as: find: <cardset(.*) replace with ABCDEF
      2) Line 3 as: find: releasedate(.*) replace with ABCDEF
      3) Line 4 as: find card_count(.*) replace with ABCDEF
      4) Save as a txt file
      5) Use Notepad to find ABCDEF and replace with a blank line.

      (I could not figure out what character in your software to specify in the replace field for a blank line)

      What I would have liked to have been able to do was steps 1-3 above in 1 find sequence (syntax?) and then have replace replace the found string with blank lines.

      Thanks in advance for you assistance!!!

      Best,
      Rudi
    • Al
      Hi, You mentioned Perl? I m not sure what your question is. 1. Enclosed perl below is close if you not need to go multi or across line(s) with search criteria.
      Message 2 of 4 , Nov 19, 2009
      • 0 Attachment
        Hi,

        You mentioned Perl?

        I'm not sure what your question is.

        1. Enclosed perl below is close if you not need to go multi or across
        line(s) with search criteria.

        2. But if each or any of your search item overlaps line(s) then **the
        enclosed perl below will not work**

        In the case of 2 above, you will need to do a file slurp into a scalar
        variable and then utilize of anti greed operator(s) in the substitution
        and also use the g for global option (# 2 gets more trickier to do than
        # 1 above.)

        s/first/second/g;

        Above shows the g option in use with the substitution operator. Finding
        appropriate anti greed is an exercise that I leave up for grabs.



        #!/usr/bin/perl -w
        use strict;

        my $old = shift;
        my $new = "$old.tmp";
        # my $base_url = ';
        open(OLD, "<", $old) or die "cant open $old: $!";
        open(NEW, ">", $new) or die "cant open $new: $!";
        while (<OLD>) {

        # 1
        # s/<cardset\.*|releasedate\.*|card_count\.*/\n/;

        # or (instead of # 1)

        s/<cardset\.*/\n/;
        s/releasedate\.*/\n/;
        s/card_count\.*/\n/;


        # puts each line, modified or not, into NEW
        print NEW $_;
        }
        # print NEW $htm_tag;
        close(OLD) or die "cant open $old: $!";
        close(NEW) or die "cant close $new: $!";
        rename($old, "$old.orig") or die "cant rename $old to $old.orig: $!";
        rename($new, "$old") or die "cant rename $new to $old: $!";
        # end

        Alan.

        RudiV wrote:
        > < . . . >
        > I had to do the Replace option in 3 steps: as I could not figure out how to embed the CRLF and the end of each line into the find command)
        >
        > 1) Line 2 as: find: <cardset(.*) replace with ABCDEF
        > 2) Line 3 as: find: releasedate(.*) replace with ABCDEF
        > 3) Line 4 as: find card_count(.*) replace with ABCDEF
        > 4) Save as a txt file
        > 5) Use Notepad to find ABCDEF and replace with a blank line.
        >
        > (I could not figure out what character in your software to specify in the replace field for a blank line)
        >
        > What I would have liked to have been able to do was steps 1-3 above in 1 find sequence (syntax?) and then have replace replace the found string with blank lines.
        >
        > Thanks in advance for you assistance!!!
        >
        > Best,
        > Rudi
        >
      • Sheri
        ... Hi Rudi, Using regex in NoteTab s Find and Replace dialog or clipcode, you can match CRLF with R or with r n. Another way is to include linebreak
        Message 3 of 4 , Nov 19, 2009
        • 0 Attachment
          --- In ntb-scripts@yahoogroups.com, "RudiV" <ms65@...> wrote:
          >
          > I had to do the Replace option in 3 steps: as I could not figure
          > out how to embed the CRLF and the end of each line into the find
          > command)
          >
          > 1) Line 2 as: find: <cardset(.*) replace with ABCDEF
          > 2) Line 3 as: find: releasedate(.*) replace with ABCDEF
          > 3) Line 4 as: find card_count(.*) replace with ABCDEF
          > 4) Save as a txt file
          > 5) Use Notepad to find ABCDEF and replace with a blank line.
          >
          > (I could not figure out what character in your software to
          > specify in the replace field for a blank line)

          >
          > What I would have liked to have been able to do was steps 1-3
          > above in 1 find sequence (syntax?) and then have replace replace
          > the found string with blank lines.
          >
          > Thanks in advance for you assistance!!!
          >

          Hi Rudi,

          Using regex in NoteTab's Find and Replace dialog or clipcode, you can match CRLF with \R or with \r\n. Another way is to include linebreak characters in what matches dot, by including (?s) at the beginning of your find pattern.

          You can include a CRLF in replacement text with \r\n

          However, I believe the following would best suit your purposes:

          ^!Replace "^(<cardset|releasedate|card_count).+" >> "" RAWS

          Since the CRLF is not matched, it is still in the file after the replacement. If you want an extra line inserted for each match, it would be:

          ^!Replace "^(<cardset|releasedate|card_count).+" >> "\r\n" RAWS

          There is a detailed, techy regex.chm file in the NoteTab application folder that gives all the details for the PCRE regex engine used in NoteTab. You can access it from the Help menu.

          Regards,
          Sheri
        • Don - HtmlFixIt.com
          Sheri, Now is a good time for us to repeat the helpful links for regex help that you have given before (one is at end of this email). One of them is what
          Message 4 of 4 , Nov 19, 2009
          • 0 Attachment
            Sheri,

            Now is a good time for us to repeat the helpful links for regex help
            that you have given before (one is at end of this email). One of them
            is what finally got me over (or at least on) the hump of understanding.
            It was a helpful tips type of presentation. I converted it from a
            powerpoint to plain text so that I could use it in notetab easier (and
            search it better) and I also now keep a "handyregexbits.txt" file in my
            favorites. It has things like (?s) in it which is the multi-line
            designation.

            I find I use it less and less as I actually now start to understand what
            I am doing and why I am doing it.

            Lastly I would encourage anyone starting with regex to get regex buddy.
            Whenever a pattern I write doesn't match as expected, I use that
            program. I start slowly at the left and move to the right and it shows
            what is matched when you select part of the search term it highlights
            the match in the lower window. Solves many issues.

            Someday I'll tackle look backs and assertions and stuff like that ...
            but for now, I really think I can do some amazing stuff with a good
            regex search term. I still use \r\n just because \R didn't work when I
            started ... I'll try to improve and actually I have used \R a few times
            lately.

            Have a great night everyone.

            Don

            The link:
            http://www.gravitonic.com/talks/
            Andrei’s Regex Clinic
            I note that there are some more recent versions -- I'll have to download
            and see if they have advanced.

            I believe regex discussion is essentially welcome either her or in clips
            list. Is that fair? I have copied both groups.

            >
            > Hi Rudi,
            >
            > Using regex in NoteTab's Find and Replace dialog or clipcode, you can match CRLF with \R or with \r\n. Another way is to include linebreak characters in what matches dot, by including (?s) at the beginning of your find pattern.
            >
            > You can include a CRLF in replacement text with \r\n
            >
            > However, I believe the following would best suit your purposes:
            >
            > ^!Replace "^(<cardset|releasedate|card_count).+" >> "" RAWS
            >
            > Since the CRLF is not matched, it is still in the file after the replacement. If you want an extra line inserted for each match, it would be:
            >
            > ^!Replace "^(<cardset|releasedate|card_count).+" >> "\r\n" RAWS
            >
            > There is a detailed, techy regex.chm file in the NoteTab application folder that gives all the details for the PCRE regex engine used in NoteTab. You can access it from the Help menu.
            >
            > Regards,
            > Sheri
          Your message has been successfully submitted and would be delivered to recipients shortly.