NBRegularExpressionCache.h 945 B

1234567891011121314151617181920212223242526272829303132333435
  1. //
  2. // NBRegularExpressionCache.h
  3. // libPhoneNumber
  4. //
  5. // Created by Paween Itthipalkul on 11/29/17.
  6. // Copyright © 2017 Google LLC. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. NS_ASSUME_NONNULL_BEGIN
  10. @interface NBRegularExpressionCache : NSObject
  11. /**
  12. Returns a singleton instance of the regular expression cache.
  13. @return An instance of NBRegularExpressionCache
  14. */
  15. + (instancetype)sharedInstance;
  16. /**
  17. Returns compiled regular expression for a given pattern.
  18. @param pattern Regular expression pattern.
  19. @param error If an error occurs, upon returns contains an NSError object that describes
  20. the problem. If you are not interested in possible errors, pass in NULL.
  21. @return A regular expression.
  22. */
  23. - (nullable NSRegularExpression *)regularExpressionForPattern:(NSString *)pattern
  24. error:(NSError * _Nullable *)error;
  25. @end
  26. NS_ASSUME_NONNULL_END