Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

정규표현식 #2

Open
gyurim opened this issue Aug 3, 2021 · 0 comments
Open

정규표현식 #2

gyurim opened this issue Aug 3, 2021 · 0 comments

Comments

@gyurim
Copy link
Owner

gyurim commented Aug 3, 2021

정규표현식

regex

Regex 인스턴스를 생성하여 생성자에 검사할 형식을 인수로 넘긴다.

  • regex re(“\d”) -> \d : 10진수 숫자 1개만 입력받는 정규식

    • regex_match(“0”, re) -> match
    • regex_match(“12”, re) -> no match
    • 이때, 0과 12는 string
  • \d: 숫자 1개만 받아야 OK

  • \d+ : 숫자 1개 이상이면 OK

  • \d* : 숫자 0개 이상이면 OK

  • \d? : 숫자 0개 혹은 1개여야 OK

  • [ab] : a나 b만 된다. 각 1개씩만. a : OK, b : OK, ab : not OK

  • [A-Z]+ : A부터 Z까지의 문자가 1개 이상이면 OK

  • [A-Z]{1,5} : A부터 Z까지의 문자가 최소 1개 최대 5개면 OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant