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

Re: text.replace documentation request [Trackered]

Expand Messages
  • Eric C. Smith
    Trackered: [ 2508336 ] [OS] TEXT.REPLACE docs need clarification https://sourceforge.net/tracker/index.php? func=detail&aid=2508336&group_id=25576&atid=748234
    Message 1 of 9 , Jan 14, 2009
    • 0 Attachment
      Trackered: [ 2508336 ] [OS] TEXT.REPLACE docs need clarification

      https://sourceforge.net/tracker/index.php?
      func=detail&aid=2508336&group_id=25576&atid=748234

      --- In pcgen@yahoogroups.com, "James Dempsey" <jdempsey@...> wrote:
      >
      > Hi Luca,
      >
      > The regular expression parser we use is the Java one, which is
      > described at http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
      > and http://java.sun.com/docs/books/tutorial/essential/regex/
      >
      > The format of the tag is
      > TEXT.REPLACEALL(regex,newtext) or
      > TEXT.REPLACEFIRST(regex,newtext)
      >
      > I'm thinking that will make the replacing of brackets difficult
      > though. The best approach might be to use a character class, (see
      > http://java.sun.com/docs/books/tutorial/essential/regex/pre_char_classes.html
      > ) and target it that way.
      >
      > --
      > Cheers,
      > James Dempsey
      > PCGen Code SB
      >
      >
      > 2009/1/15 cantarellus <cantarellus@...>:
      > > If you refer to this part of the documentation:
      > > REPLACE, REPLACEALL - Performs a regular expression based search and
      > > replace on the string produced by the associated token. Multiple
      > > replacements can be specified and are processed right to left.
      > >
      > > I've red it, but still have no clue of how to use in a real case.
      > > I need to get rid of blank spaces and parenthesys from skill name and
      > > replace seemed a good choice, but I expect that Ill have to write the
      > > regular expression somewhere ...
      > > How? Which is the syntax? Other TEXT variables are more straightfoward.
      > > Can you post an example?
      > > Thanks
      > > Luca
      > >
      > > --- In pcgen@yahoogroups.com, maredudd@ wrote:
      > >>
      > >> Hi Luca!
      > >>
      > >> If you look at the docs (under the Help Menu) and go to the "TEXT"
      > > token on the Output Sheet Token Index.
      > >>
      > >> Eric Smith
      > >> Doc 2nd
      > >>
      > >> -----Original Message-----
      > >> From: cantarellus [mailto:cantarellus@]
      > >> Sent: Wednesday, January 14, 2009 02:26 PM
      > >> To: pcgen@yahoogroups.com
      > >> Subject: [pcgen] text.replace documentation request
      > >>
      > >> Is there somewhere the documentation of the text.replace function for
      > >> the output sheet?
      > >> Thanks
      > >> Luca
      >
    • cantarellus
      OK, I ll mtry to reformulate the question. I m building a custom csheet.xml much like the csheet_fantasy_rpgwebprofiler.xml ... and this work Now I get
      Message 2 of 9 , Jan 14, 2009
      • 0 Attachment
        OK,
        I'll mtry to reformulate the question.

        I'm building a custom csheet.xml much like the
        csheet_fantasy_rpgwebprofiler.xml

        The syntax for getting a list of skill is:
        |FOR.0,COUNT[SKILLS],1,\SKILL.%\=\SKILL.%.ABMOD\, ,;,1|
        and this work
        Now I get something like:
        Appraise=3; Balance=3; Bluff=2; Climb=3; Concentration=3; Craft
        (Stonemasonry)=3;

        My need is to get Craft_Stonemasonry
        I was wandering if there was a string replace in the output sheet tokens
        I saw that there is the TEXT that should work in this way:
        |FOR.0,COUNT[SKILLS],1,\TEXT.UPPER.SKILL.%\=\SKILL.%.ABMOD\, ,;,1|
        This works so I tryed REPLACEALL like this
        |FOR.0,COUNT[SKILLS],1,\TEXT.REPLACEALL(/
        /,'_').SKILL.%\=\(SKILL.%.RANK).INTVAL\, ,;,1|
        but the "," in the (/ /,'_') is interpreted as a "," of the FOR loop.
        Is there a way to apply the REPLACEALL in the loop in the same way UPPER
        is used?
        This was the syntax I was referring not the regexp (that may be wrong,
        but ..)
        Thanks
        Luca

        --- In pcgen@yahoogroups.com, "James Dempsey" <jdempsey@...> wrote:
        >
        > Hi Luca,
        >
        > The regular expression parser we use is the Java one, which is
        > described at
        http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
        > and http://java.sun.com/docs/books/tutorial/essential/regex/
        >
        > The format of the tag is
        > TEXT.REPLACEALL(regex,newtext) or
        > TEXT.REPLACEFIRST(regex,newtext)
        >
        > I'm thinking that will make the replacing of brackets difficult
        > though. The best approach might be to use a character class, (see
        >
        http://java.sun.com/docs/books/tutorial/essential/regex/pre_char_classes\
        .html
        > ) and target it that way.
        >
        > --
        > Cheers,
        > James Dempsey
        > PCGen Code SB
        >
        >
        > 2009/1/15 cantarellus cantarellus@...:
        > > If you refer to this part of the documentation:
        > > REPLACE, REPLACEALL - Performs a regular expression based search and
        > > replace on the string produced by the associated token. Multiple
        > > replacements can be specified and are processed right to left.
        > >
        > > I've red it, but still have no clue of how to use in a real case.
        > > I need to get rid of blank spaces and parenthesys from skill name
        and
        > > replace seemed a good choice, but I expect that Ill have to write
        the
        > > regular expression somewhere ...
        > > How? Which is the syntax? Other TEXT variables are more
        straightfoward.
        > > Can you post an example?
        > > Thanks
        > > Luca
        > >
        > > --- In pcgen@yahoogroups.com, maredudd@ wrote:
        > >>
        > >> Hi Luca!
        > >>
        > >> If you look at the docs (under the Help Menu) and go to the "TEXT"
        > > token on the Output Sheet Token Index.
        > >>
        > >> Eric Smith
        > >> Doc 2nd
        > >>
        > >> -----Original Message-----
        > >> From: cantarellus [mailto:cantarellus@]
        > >> Sent: Wednesday, January 14, 2009 02:26 PM
        > >> To: pcgen@yahoogroups.com
        > >> Subject: [pcgen] text.replace documentation request
        > >>
        > >> Is there somewhere the documentation of the text.replace function
        for
        > >> the output sheet?
        > >> Thanks
        > >> Luca
        >



        [Non-text portions of this message have been removed]
      • cantarellus
        For some reason I can t see the post so could be my connection that is erratic so I repost (sorry if it comes up double post) OK, I ll try to reformulate the
        Message 3 of 9 , Jan 14, 2009
        • 0 Attachment
          For some reason I can't see the post so could be my connection that is
          erratic so I repost (sorry if it comes up double post)

          OK,
          I'll try to reformulate the question.

          I'm building a custom csheet.xml much like the
          csheet_fantasy_rpgwebprofiler.xml

          The syntax for getting a list of skill is:
          |FOR.0,COUNT[SKILLS],1,\SKILL.%\=\SKILL.%.ABMOD\, ,;,1|
          and this work
          Now I get something like:
          Appraise=3; Balance=3; Bluff=2; Climb=3; Concentration=3; Craft
          (Stonemasonry)=3;

          I need Craf_Stonemasonry

          I looked to REPLACEALL as a string replacement function first tryed
          this:
          |FOR.0,COUNT[SKILLS],1,\TEXT.UPPER.SKILL.%\=\SKILL.%.ABMOD\, ,;,1|
          And it worked so I went confidently to
          |FOR.0,COUNT[SKILLS],1,\TEXT.REPLACEALL(/
          /,'_').SKILL.%\=\(SKILL.%.RANK).INTVAL\, ,;,1|
          With no luck since the "," of (/ /,'_') get interpreted as a "," of the
          FOR loop.

          I'm not sure that is possible to use the TEXT.REPLACEALL(regex,newtext)
          in this context or there isn't anywhere the syntax for how to use it in
          output sheet.
          This is the syntax help I was looking for.
          Thanks.
          Luca

          --- In pcgen@yahoogroups.com, "James Dempsey" <jdempsey@...> wrote:
          >
          > Hi Luca,
          >
          > The regular expression parser we use is the Java one, which is
          > described at
          http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
          > and http://java.sun.com/docs/books/tutorial/essential/regex/
          >
          > The format of the tag is
          > TEXT.REPLACEALL(regex,newtext) or
          > TEXT.REPLACEFIRST(regex,newtext)
          >
          > I'm thinking that will make the replacing of brackets difficult
          > though. The best approach might be to use a character class, (see
          >
          http://java.sun.com/docs/books/tutorial/essential/regex/pre_char_classes\
          .html
          > ) and target it that way.
          >
          > --
          > Cheers,
          > James Dempsey
          > PCGen Code SB
          >
          >
          > 2009/1/15 cantarellus cantarellus@...:
          > > If you refer to this part of the documentation:
          > > REPLACE, REPLACEALL - Performs a regular expression based search and
          > > replace on the string produced by the associated token. Multiple
          > > replacements can be specified and are processed right to left.
          > >
          > > I've red it, but still have no clue of how to use in a real case.
          > > I need to get rid of blank spaces and parenthesys from skill name
          and
          > > replace seemed a good choice, but I expect that Ill have to write
          the
          > > regular expression somewhere ...
          > > How? Which is the syntax? Other TEXT variables are more
          straightfoward.
          > > Can you post an example?
          > > Thanks
          > > Luca
          > >
          > > --- In pcgen@yahoogroups.com, maredudd@ wrote:
          > >>
          > >> Hi Luca!
          > >>
          > >> If you look at the docs (under the Help Menu) and go to the "TEXT"
          > > token on the Output Sheet Token Index.
          > >>
          > >> Eric Smith
          > >> Doc 2nd
          > >>
          > >> -----Original Message-----
          > >> From: cantarellus [mailto:cantarellus@]
          > >> Sent: Wednesday, January 14, 2009 02:26 PM
          > >> To: pcgen@yahoogroups.com
          > >> Subject: [pcgen] text.replace documentation request
          > >>
          > >> Is there somewhere the documentation of the text.replace function
          for
          > >> the output sheet?
          > >> Thanks
          > >> Luca
          >



          [Non-text portions of this message have been removed]
        • cantarellus
          Any help on the subject? Thanks Luca ... http://java.sun.com/docs/books/tutorial/essential/regex/pre_char_classes
          Message 4 of 9 , Jan 17, 2009
          • 0 Attachment
            Any help on the subject?
            Thanks
            Luca

            --- In pcgen@yahoogroups.com, "cantarellus" <cantarellus@...> wrote:
            >
            > OK,
            > I'll mtry to reformulate the question.
            >
            > I'm building a custom csheet.xml much like the
            > csheet_fantasy_rpgwebprofiler.xml
            >
            > The syntax for getting a list of skill is:
            > |FOR.0,COUNT[SKILLS],1,\SKILL.%\=\SKILL.%.ABMOD\, ,;,1|
            > and this work
            > Now I get something like:
            > Appraise=3; Balance=3; Bluff=2; Climb=3; Concentration=3; Craft
            > (Stonemasonry)=3;
            >
            > My need is to get Craft_Stonemasonry
            > I was wandering if there was a string replace in the output sheet tokens
            > I saw that there is the TEXT that should work in this way:
            > |FOR.0,COUNT[SKILLS],1,\TEXT.UPPER.SKILL.%\=\SKILL.%.ABMOD\, ,;,1|
            > This works so I tryed REPLACEALL like this
            > |FOR.0,COUNT[SKILLS],1,\TEXT.REPLACEALL(/
            > /,'_').SKILL.%\=\(SKILL.%.RANK).INTVAL\, ,;,1|
            > but the "," in the (/ /,'_') is interpreted as a "," of the FOR loop.
            > Is there a way to apply the REPLACEALL in the loop in the same way UPPER
            > is used?
            > This was the syntax I was referring not the regexp (that may be wrong,
            > but ..)
            > Thanks
            > Luca
            >
            > --- In pcgen@yahoogroups.com, "James Dempsey" <jdempsey@> wrote:
            > >
            > > Hi Luca,
            > >
            > > The regular expression parser we use is the Java one, which is
            > > described at
            > http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
            > > and http://java.sun.com/docs/books/tutorial/essential/regex/
            > >
            > > The format of the tag is
            > > TEXT.REPLACEALL(regex,newtext) or
            > > TEXT.REPLACEFIRST(regex,newtext)
            > >
            > > I'm thinking that will make the replacing of brackets difficult
            > > though. The best approach might be to use a character class, (see
            > >
            >
            http://java.sun.com/docs/books/tutorial/essential/regex/pre_char_classes\
            > .html
            > > ) and target it that way.
            > >
            > > --
            > > Cheers,
            > > James Dempsey
            > > PCGen Code SB
            > >
            > >
            > > 2009/1/15 cantarellus cantarellus@:
            > > > If you refer to this part of the documentation:
            > > > REPLACE, REPLACEALL - Performs a regular expression based search and
            > > > replace on the string produced by the associated token. Multiple
            > > > replacements can be specified and are processed right to left.
            > > >
            > > > I've red it, but still have no clue of how to use in a real case.
            > > > I need to get rid of blank spaces and parenthesys from skill name
            > and
            > > > replace seemed a good choice, but I expect that Ill have to write
            > the
            > > > regular expression somewhere ...
            > > > How? Which is the syntax? Other TEXT variables are more
            > straightfoward.
            > > > Can you post an example?
            > > > Thanks
            > > > Luca
            > > >
            > > > --- In pcgen@yahoogroups.com, maredudd@ wrote:
            > > >>
            > > >> Hi Luca!
            > > >>
            > > >> If you look at the docs (under the Help Menu) and go to the "TEXT"
            > > > token on the Output Sheet Token Index.
            > > >>
            > > >> Eric Smith
            > > >> Doc 2nd
            > > >>
            > > >> -----Original Message-----
            > > >> From: cantarellus [mailto:cantarellus@]
            > > >> Sent: Wednesday, January 14, 2009 02:26 PM
            > > >> To: pcgen@yahoogroups.com
            > > >> Subject: [pcgen] text.replace documentation request
            > > >>
            > > >> Is there somewhere the documentation of the text.replace function
            > for
            > > >> the output sheet?
            > > >> Thanks
            > > >> Luca
            > >
            >
            >
            >
            > [Non-text portions of this message have been removed]
            >
          • James Dempsey
            Hi Luca, Yes that inline for syntax will probably make a mess of the regex pattern. Instead I tried the other FOR style and came up with the ... Note, you can
            Message 5 of 9 , Jan 20, 2009
            • 0 Attachment
              Hi Luca,

              Yes that inline for syntax will probably make a mess of the regex
              pattern. Instead I tried the other FOR style and came up with the
              following, which gets close to what you want:

              |FOR,%i,0,COUNT[SKILLS]-1,1,0|
              |TEXT.REPLACEALL{\W+,_}.SKILL.%i|=|(SKILL.%i.RANK).INTVAL|,
              |ENDFOR|

              Note, you can also chain replaces to make mutliple changes - you might
              need to do this to get what you want.

              e.g. |TEXT.REPLACEALL{\W+,_}.TEXT.REPLACEALL{a,A}.SKILL.%i|=|(SKILL.%i.RANK).INTVAL|

              Cheers,
              James.

              2009/1/15 cantarellus <cantarellus@...>:
              > For some reason I can't see the post so could be my connection that is
              > erratic so I repost (sorry if it comes up double post)
              >
              > OK,
              > I'll try to reformulate the question.
              >
              > I'm building a custom csheet.xml much like the
              > csheet_fantasy_rpgwebprofiler.xml
              >
              > The syntax for getting a list of skill is:
              > |FOR.0,COUNT[SKILLS],1,\SKILL.%\=\SKILL.%.ABMOD\, ,;,1|
              > and this work
              > Now I get something like:
              > Appraise=3; Balance=3; Bluff=2; Climb=3; Concentration=3; Craft
              > (Stonemasonry)=3;
              >
              > I need Craf_Stonemasonry
              >
              > I looked to REPLACEALL as a string replacement function first tryed
              > this:
              > |FOR.0,COUNT[SKILLS],1,\TEXT.UPPER.SKILL.%\=\SKILL.%.ABMOD\, ,;,1|
              > And it worked so I went confidently to
              > |FOR.0,COUNT[SKILLS],1,\TEXT.REPLACEALL(/
              > /,'_').SKILL.%\=\(SKILL.%.RANK).INTVAL\, ,;,1|
              > With no luck since the "," of (/ /,'_') get interpreted as a "," of the
              > FOR loop.
              >
              > I'm not sure that is possible to use the TEXT.REPLACEALL(regex,newtext)
              > in this context or there isn't anywhere the syntax for how to use it in
              > output sheet.
              > This is the syntax help I was looking for.
              > Thanks.
              > Luca
              >
              > --- In pcgen@yahoogroups.com, "James Dempsey" <jdempsey@...> wrote:
              >>
              >> Hi Luca,
              >>
              >> The regular expression parser we use is the Java one, which is
              >> described at
              > http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
              >> and http://java.sun.com/docs/books/tutorial/essential/regex/
              >>
              >> The format of the tag is
              >> TEXT.REPLACEALL(regex,newtext) or
              >> TEXT.REPLACEFIRST(regex,newtext)
              >>
              >> I'm thinking that will make the replacing of brackets difficult
              >> though. The best approach might be to use a character class, (see
              >>
              > http://java.sun.com/docs/books/tutorial/essential/regex/pre_char_classes\
              > .html
              >> ) and target it that way.
              >>
              >> --
              >> Cheers,
              >> James Dempsey
              >> PCGen Code SB
              >>
              >>
              >> 2009/1/15 cantarellus cantarellus@...:
              >> > If you refer to this part of the documentation:
              >> > REPLACE, REPLACEALL - Performs a regular expression based search and
              >> > replace on the string produced by the associated token. Multiple
              >> > replacements can be specified and are processed right to left.
              >> >
              >> > I've red it, but still have no clue of how to use in a real case.
              >> > I need to get rid of blank spaces and parenthesys from skill name
              > and
              >> > replace seemed a good choice, but I expect that Ill have to write
              > the
              >> > regular expression somewhere ...
              >> > How? Which is the syntax? Other TEXT variables are more
              > straightfoward.
              >> > Can you post an example?
              >> > Thanks
              >> > Luca
              >> >
              >> > --- In pcgen@yahoogroups.com, maredudd@ wrote:
              >> >>
              >> >> Hi Luca!
              >> >>
              >> >> If you look at the docs (under the Help Menu) and go to the "TEXT"
              >> > token on the Output Sheet Token Index.
              >> >>
              >> >> Eric Smith
              >> >> Doc 2nd
              >> >>
              >> >> -----Original Message-----
              >> >> From: cantarellus [mailto:cantarellus@]
              >> >> Sent: Wednesday, January 14, 2009 02:26 PM
              >> >> To: pcgen@yahoogroups.com
              >> >> Subject: [pcgen] text.replace documentation request
              >> >>
              >> >> Is there somewhere the documentation of the text.replace function
              > for
              >> >> the output sheet?
              >> >> Thanks
              >> >> Luca
            Your message has been successfully submitted and would be delivered to recipients shortly.