Skip Navigation
Expand
Sometimes the values in a string do not accept a character even when this is part of the regular expression
Answer ID 12466   |   Last Review Date 11/11/2022

Why do I get validation error when I type some character even though my regular expression accepts it?

Environment:

All versions of Oracle Field Service (OFS)

Issue:

While trying to fill string properties within forms, your business may need to restrict the acceptable characters that the technicians can use in those fields. This restriction is handled using regular expressions, however there are some times where even having some characters filtered by the regular expression does not seem enough.

Resolution:

It has been observed that, due to the fact that Oracle Field Service (OFS) Application can be accessed through a multitude of devices and platforms, the way the technicians are filling data is different and dependant on the device's keyboard and keyboard settings.

For specific platforms, filling in specific characters are even triggering device functionality to change the input to some, different, special character, that may not be captured by the configured regular expression. One such example is the iOS functionality called "Smart Punctuation", however there are more cases where the character filled by specific keyboard settings isn't the one considered standard by the regular expressions.

These are the cases where we noticed devices sending a special character instead of regular characters:

  • "three dots" - It was found that, due to the above mentioned iOS functionality "Smart Punctuation", if technician is typing 3 dots at some point in the string, these will be automatically replaced by special character called Horizontal Ellipsis (…). Regular expression can be amended by adding \u2026 to current formula, to cover this character.
  • "two hyphens" - Similarly to above, iOS will replace two hyphens (--) when typed together by special character called Em Dash (—). Regular expression can be amended by adding \u2014 to current formula, to cover this character.
  • "space" - It was also found that, under some specific keyboard settings, technicians may send a specific No-Break Space (NBSP) ( ) instead of a regular Space ( ). While regular spaces can be accepted in a regular expressions by adding \s, this specific no-break space can be accepted (or excluded) by adding \u0040 to the current formula.

One final remark that must be made is that regular expressions themselves are being interpreted and evaluated differently by different programming languages. An example is the fact that the above "no-break space" is accepted by regular expressions in Javascript, which is the language in which the Oracle Field Service (OFS)'s Graphical User Interface (GUI) is written, however the same "no-break space" character is rejected by regular expressions in C language, which is being used by the database. This situation will produce a case where technician can fill the form with the given "no-break space" character and no errors will be thrown upon submit, because javascript validated the string as correct, but the value will be rejected and not saved in the database itself, because C rejected the string as invalid.  

Please note that there may be other cases as well which you may face and we may review and add to the above list if or when necessary.