GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
regex_match(3) rationL User Manual regex_match(3)

regex_match – Matche a string from against a compiled regular expression

#include <rationl.h>
int regex_match(reg_t re, char *string);
    

regex_match() matches a regular expression against a string and returns true(1) if the regular expression matches the string or false(0) otherwise.

re The regular expression that was compiled using regex_compile

string The string to match the regular expression against

regex_match() returns true(1) if the string passed as parameter is matched by the regular expression false(0) if not.

Program that matches an email address passed as first parameter

#include <rationl.h>
#include <err.h>
#include <stdio.h>
int main(int argc, char** argv)
{

if(argc != 2)
errx(1, "No input email address found.");
reg_t re = regex_compile("\\w+(\\.\\w+)?@\\w+(\\.[a-z]{2,})+");
if(regex_match(re, argv[1]))
printf("%s is a valid email.\n", argv[1]);
else
printf("%s is not a valid email.\n", argv[1]);
regex_free(re);
return 0; }
April 5, 2021 rationL 0.1.0

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.