Regular Expressions

Regular Expressions are a powerful and complex pattern that can be used for searching or validating input.

Regular expressions are of the form /pattern/ .  You can use regular expressions in various places in MyPhotoApp.  MyPhotoApp will automatically provide the front end ending slash, so all you need to do is provide the pattern.   

Here is an example of a pattern:

^\d+$

That will test that the input only contains digits.   It does look cryptic and is hard to understand at first, but it provides flexibility and power to you that is much more than could possibly achieve otherwise.   

Another example:

^\(\d\d\d\) \d\d\d\-\d\d\d\d$

Will test that the input is of the form  (ddd) ddd-dddd where the d's are a digit. 

Here are related articles that will help you get up to speed using Regular Expressions.  Many common patterns are already available on the internet, so you can just do a search.  

Related Articles:

Wikipedia Entry: https://en.wikipedia.org/wiki/Regular_expression

Regular Expressions For Beginners: https://www.marksanborn.net/howto/learning-regular-expressions-for-beginners-the-basics/

Online Regular Expression Tester: http://www.regexpal.com/

Library of common regular expressions: http://www.regexlib.com/

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.
Powered by Zendesk