Overview : 특정문자 제외해서 찾기
1.앞문장이 공백~2 까지 이고, 뒤에서 .(모든단에서조사하여) cream|candy 없는 문장
Regular expression
1 2 3 4 5 6 7 8 |
^\s{0,2}((?!cream|candy).)*$ i like ice cream i like candy i like chocolate i have no money |
Result
1 2 3 4 |
i like chocolate i have no money |
2.앞단어가 공백~2 까지이고, 조건에 맞는 그룹(1)에 맞으면 맨뒤 단어가 cream, 아니면 candy 인 문장
Regular expression
1 2 3 4 5 6 7 8 9 10 |
^(\s{0,2}i)?.*(?(1)cream|candy)$ i like ice cream i like candy i like chocolate i have no money => i like candy d |
3. 조건 단어가 있으면 특정단어또는 문장 찾기 / 없으면 다른 문장 찾기
Regular expression
1 2 3 4 5 6 7 8 9 10 11 12 13 |
(?(?=.*choco)(?:i like.*)|(?:i have no money)) i have ice cream i have candy i like chocolate i have no money i love chocolate =>i like chocolate i have no money |
4. CHANGES CANCELLATIONS 이전 문장 개수
Regular expression
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
^\s{0,2}[A-Z](?!HANGES|ANCEL).* UNLESS OTHERWISE SPECIFIED APPLIES CANCELLATIONS BEFORE DEPARTURE CHANGES ANY TIME FOR TICKETING ON/AFTER 01JAN 19 CHANGES/CANCELLATIONS ANY TIME =>UNLESS OTHERWISE SPECIFIED APPLIES FOR TICKETING ON/AFTER 01JAN 19 |