Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Regular Expressions in Objective-C and Core Data

Is there a guide to using regular expressions in objective c? Specifically what to type into the "Reg. Ex." field in a core data property?

In particular, how to limit input to a set amount of numbers/letters only, and for UK Post Codes?

Thanks!

like image 952
Michael Avatar asked Dec 22 '22 07:12

Michael


1 Answers

According to the Apple documentation, the NSPredicate regex support implements the ICU package, so check their pages for documentation:

ICU Regex Documentation

For example, a regular expression of [0-9a-zA-Z]{5} could be used match on exactly 5 numbers or letters. (So would the shorter form of [\w\d]{5} though that also permits a few other characters)

like image 83
wadesworld Avatar answered Jan 06 '23 13:01

wadesworld