回答編集履歴
1
objc
test
CHANGED
@@ -9,3 +9,63 @@
|
|
9
9
|
|
10
10
|
|
11
11
|
で解決すると思います。
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
【追記】
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
せっかくなのでObjective-Cで作ってみました。
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
```objectivec
|
24
|
+
|
25
|
+
NSString *text = @
|
26
|
+
|
27
|
+
"return_to_login: 'Return to login'\n"
|
28
|
+
|
29
|
+
"click_here_to_reset_password: 'Click here to reset your password'\n"
|
30
|
+
|
31
|
+
"reset_password_email_subject: 'Your Password Reset Link'\n"
|
32
|
+
|
33
|
+
"reset_password: 'Reset Password'\n"
|
34
|
+
|
35
|
+
"confirm_password: 'Confirm password'\n"
|
36
|
+
|
37
|
+
;
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
NSError *error;
|
42
|
+
|
43
|
+
NSRegularExpression *expr = [NSRegularExpression regularExpressionWithPattern:@"'([^']*)'" options:0 error:&error];
|
44
|
+
|
45
|
+
if (error == nil) {
|
46
|
+
|
47
|
+
[expr enumerateMatchesInString:text options:0 range:NSMakeRange(0, text.length) usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop) {
|
48
|
+
|
49
|
+
NSLog(@"%@", [text substringWithRange:[result rangeAtIndex:1]]);
|
50
|
+
|
51
|
+
}];
|
52
|
+
|
53
|
+
}
|
54
|
+
|
55
|
+
```
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
```text
|
60
|
+
|
61
|
+
Return to login
|
62
|
+
|
63
|
+
Click here to reset your password
|
64
|
+
|
65
|
+
Your Password Reset Link
|
66
|
+
|
67
|
+
Reset Password
|
68
|
+
|
69
|
+
Confirm password
|
70
|
+
|
71
|
+
```
|