test for alphanumeric plus a few characters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kayakbabe
    Mega Mivite




    • Jun 2008
    • 1520

    #1

    test for alphanumeric plus a few characters

    I must be brain dead today becuase I think I've done this before...
    I want to test if a variable contains alphanumeric plus period, hyphen and underscore characters

    I think toolbelt will do it but I can't figure out the syntax.

    I have tried this first
    <mvt:item name="ry_toolbelt" param="Assign|g.ke_test|isAlphaNumPlus(l.all_setti ngs:item:image,'.-_')" />
    Then I tried this to test only for a period
    <mvt:item name="ry_toolbelt" param="Assign|g.ke_test|isAlphaNumPlus(l.all_setti ngs:item:image,asciichar(46))" />

    toolbelt is supposed to return a 1 (passed the tests) or a 0 (doesn't pass the test)

    anyway I"m just not getting the syntax for it and I do have the current toolbelt.
    Can some of you peeps help out (I can't find any example in the forum when I search for isAlphaNumPlus)?

    Or maybe there is a toolkit command to test for alphanumberic plus a few characters?
    Last edited by kayakbabe; 10-02-13, 11:11 AM.
  • kayakbabe
    Mega Mivite




    • Jun 2008
    • 1520

    #2
    Re: test for alphanumeric plus a few characters

    I think I figured it out..
    Code:
    <mvt:item name="ry_toolbelt" param="assign|g.IsValid|isAlphaNumPlus(l.all_settings:item:image,'./-_')" />
    but that's not what I want
    because it is still letting spaces and parenthesis through

    I need to test for 0-9a-zA-Z plus ./-_ characters. if the variable contains anything else then I want a 0 or false answer
    Last edited by kayakbabe; 10-02-13, 11:24 AM.

    Comment

    • kayakbabe
      Mega Mivite




      • Jun 2008
      • 1520

      #3
      Re: test for alphanumeric plus a few characters

      here is an inelegant solution which won't catch everything.. but most of what I Was trying to avoid.
      The problem is it won't catch any weird characters that I do not explicitly test for.
      I KNOW some of my data that is bad has parenthesis, comma, space, brackets and pound signs...
      there might be others. and this won't catch them.

      <mvt:item name="ry_toolbelt" param="assign|g.KE_test|glosub(l.all_settings:item :image,' ','')" />
      <mvt:item name="ry_toolbelt" param="assign|g.KE_test|glosub(g.KE_test,'(','')" />
      <mvt:item name="ry_toolbelt" param="assign|g.KE_test|glosub(g.KE_test,')','')" />
      <mvt:item name="ry_toolbelt" param="assign|g.KE_test|glosub(g.KE_test,'#','')" />
      <mvt:item name="ry_toolbelt" param="assign|g.KE_test|glosub(g.KE_test,'[','')" />
      <mvt:item name="ry_toolbelt" param="assign|g.KE_test|glosub(g.KE_test,']','')" />




      <mvt:if expr="len(l.settings:item:image) EQ len(g.KE_test)">
      OK - contains no bad characters that I tested for
      <mvt:else>
      BAD - contains at least one of the disallowed characters
      </mvt:if>

      Guess I"M still looking for a better solution.
      Last edited by kayakbabe; 10-02-13, 11:49 AM.

      Comment

      Working...
      X