Substring Validation Using Custom Pattern Matching - InfoPath Dev
in

InfoPath Dev

Substring Validation Using Custom Pattern Matching

Last post 03-17-2014 08:10 AM by JeffVojtko. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 03-14-2014 05:52 AM

    Substring Validation Using Custom Pattern Matching

    I have a 40 character string inside a textbox where the 14, 15 and 16 characters must be numeric.

    I am trying to get either on of these custom patterns to work -

    xdUtil:Match(string(substring(., 14, 3)), "\d\d\d")
    xdUtil:Match(string(substring(., 14, 3)), "\[0-9]\[0-9]\[0-9]") 

    But, neither of these patterns seem to validate that the 14th and next two characters are digits.

    Jeffrey J Vojtko
  • 03-17-2014 08:10 AM In reply to

    Re: Substring Validation Using Custom Pattern Matching

    The way I was firing an error on the textbox field was to set a second field with the value of Error in err situation and Good in situations where the text passed validation. And, in the first textbox I was messing around with different custom validation rules and having no luck getting them to work. So, I deleted the old rules and put in two new rules and viola, it all of a sudden worked with the following:

    Good - xdUtil:Match(string(substring(., 14, 3)), "\d\d\d")
    Error - not(xdUtil:Match(string(substring(., 14, 3)), "\d\d\d"))

     

    Jeffrey J Vojtko
Page 1 of 1 (2 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.