C Library Functions - match (3)
NAME
match(3f) - [M_MATCH] find match to a basic regular expression anywhere on input string
(LICENSE:PD)
CONTENTS
Synopsis
Description
Options
Examples
Author
Reference
License
SYNOPSIS
integer function match(line, pattern)
character(len=*),intent(in) :: line
integer,intent(in) :: pattern(MAXPAT)
DESCRIPTION
Given a BRE(Basic Regular Expression) converted to a pattern
return whether an input string matches it.
OPTIONS
|
LIN |
string to search for a match to the pattern
|
|
PAT |
pattern generated from a BRE using getpat(3f) or makpat(3f).
|
|
EXAMPLES
Sample program:
program demo_match
use :: M_match, only : getpat, match
use :: M_match, only : MAXPAT, MAXARG, MAXLINE, YES, ERR
implicit none
! find _ find patterns in text
integer :: pat(MAXPAT)
character(len=MAXARG-1) :: argument
integer :: stat
integer :: ios
integer :: len_arg
character(len=MAXLINE-2) :: line
call get_command_argument(1, argument,status=stat,length=len_arg)
if(stat.ne.0.or.argument.eq.)then
write(*,*)"usage: find pattern."
elseif(getpat(argument(:len_arg), pat) .eq. ERR) then
write(*,*)"illegal pattern."
else
INFINITE: do
read(*,(a),iostat=ios)line
if(ios.ne.0)exit
if(match(trim(line), pat) .eq. YES) then
write(*,(*(a)))trim(line)
endif
enddo INFINITE
endif
end program demo_match
AUTHOR
John S. Urban
REFERENCE
"Software Tools" by Kernighan and Plauger , 1976
LICENSE
Public Domain
| Nemo Release 3.1 | match (3) | June 29, 2025 |
Generated by manServer 1.08 from 6c22946e-1c3f-44f7-8f09-e8ba141ee74a using man macros.