-1

I have used regex.h header file in my code and the code works perfectly fine and it extracts the domain name from any URL except protocol. Also it uses regcmp to compile the regex and regexec to execute the matching portion of the regex to given URL.

What does

(\\/.*-)?(w+)([a-z, A-Z, 0-9, .])* 

regular expression actually mean in C?

Jonathan Leffler
  • 698,132
  • 130
  • 858
  • 1,229
  • 2
    There are no regular expressions in C. Are you using some library? If so, tell us, which library. Also, the string does not look like a meaningful regular expression. – DYZ May 27 '22 at 06:11
  • If you test it, what results do you get? What do you expect it to do? What did you intend it to do when you wrote it? Show an example of the input and expected output. – Solar Mike May 27 '22 at 06:13
  • Does this answer your question? [Reference - What does this regex mean?](https://stackoverflow.com/questions/22937618/reference-what-does-this-regex-mean) – Nick May 27 '22 at 06:15
  • I have used regex.h header file also the code works perfectly fine and this regex retrieve domain name from an url – Sifat Sikder May 27 '22 at 06:23
  • regex has nothing to do with C, and no one knows what `regex.h` means. Lots of libraries have that header – phuclv May 27 '22 at 06:53
  • Try https://regex101.com/ – pmg May 27 '22 at 13:02
  • POSIX has a header [``](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/regex.h.html) with the main support functions `regcomp()` and [`regexec()`](https://pubs.opengroup.org/onlinepubs/9699919799/functions/regexec.html). Your question mentions `regcmpto` (probably a typo for "`regcmp` to"), but is `regcmp` also a misspelling? If you are using the POSIX regular expression package, the meaning of the regex changes depending on whether you compile it with `REG_EXTENDED` or not. Repating the comma and space in the character class is weird and pointless. – Jonathan Leffler May 27 '22 at 13:04

0 Answers0