PCRE_GET_SUBSTRING(3) Library Functions Manual PCRE_GET_SUBSTRING(3)NAME
PCRE - Perl-compatible regular expressions
SYNOPSIS
#include <pcre.h>
int pcre_get_substring(const char *subject, int *ovector,
int stringcount, int stringnumber,
const char **stringptr);
DESCRIPTION
This is a convenience function for extracting a captured substring. The arguments are:
subject Subject that has been successfully matched
ovector Offset vector that pcre_exec() used
stringcount Value returned by pcre_exec()
stringnumber Number of the required substring
stringptr Where to put the string pointer
The memory in which the substring is placed is obtained by calling pcre_malloc(). The convenience function pcre_free_substring() can be
used to free it when it is no longer needed. The yield of the function is the length of the substring, PCRE_ERROR_NOMEMORY if sufficient
memory could not be obtained, or PCRE_ERROR_NOSUBSTRING if the string number is invalid.
There is a complete description of the PCRE native API in the pcreapi page and a description of the POSIX API in the pcreposix page.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+--------------------+-----------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+--------------------+-----------------+
|Availability | SUNWpcre |
+--------------------+-----------------+
|Interface Stability | Uncommitted |
+--------------------+-----------------+
NOTES
Source for PCRE is available on http://opensolaris.org.
PCRE_GET_SUBSTRING(3)
Check Out this Related Man Page
PCRE_GET_SUBSTRING(3) Library Functions Manual PCRE_GET_SUBSTRING(3)NAME
PCRE - Perl-compatible regular expressions
SYNOPSIS
#include <pcre.h>
int pcre_get_substring(const char *subject, int *ovector,
int stringcount, int stringnumber,
const char **stringptr);
int pcre16_get_substring(PCRE_SPTR16 subject, int *ovector,
int stringcount, int stringnumber,
PCRE_SPTR16 *stringptr);
int pcre32_get_substring(PCRE_SPTR32 subject, int *ovector,
int stringcount, int stringnumber,
PCRE_SPTR32 *stringptr);
DESCRIPTION
This is a convenience function for extracting a captured substring. The arguments are:
subject Subject that has been successfully matched
ovector Offset vector that pcre[16|32]_exec() used
stringcount Value returned by pcre[16|32]_exec()
stringnumber Number of the required substring
stringptr Where to put the string pointer
The memory in which the substring is placed is obtained by calling pcre[16|32]_malloc(). The convenience function pcre[16|32]_free_sub-
string() can be used to free it when it is no longer needed. The yield of the function is the length of the substring, PCRE_ERROR_NOMEMORY
if sufficient memory could not be obtained, or PCRE_ERROR_NOSUBSTRING if the string number is invalid.
There is a complete description of the PCRE native API in the pcreapi page and a description of the POSIX API in the pcreposix page.
PCRE 8.30 24 June 2012 PCRE_GET_SUBSTRING(3)
can we do substring fuctionality using AWK
say I have string "sandeep"
can i pick up only portion "nde" from it.
Thanks and Regards
Sandeep Ranade (3 Replies)
I have two files:
One is a list of numbers:
1
5
6
7
10
The second is a very long string
abcdefghijklmno......1234567890
I'd like to print a new file with a 5 character substring that starts at each the positions listed in the 1st file:
such as:
abcde (4 Replies)
Hi all,
I am stuck in a tricky situation where i want to search a substring from a line through shell script.What i meant by that is given in the example shown below:
Line :: This is the TEST(Message(with some tricky word)) from which i want to search.
Result substring should be :... (8 Replies)
hi
i need to name a file with a substring of a another file name.
i.e. if the old filename is abc.txt , the new filename should be abc_1.txt
i should get the substring of the file name and then name the new one
please let me know how to do it (4 Replies)
I retrieved values from postgresql database
return the following line
name ------------ myname (1 row)
how can I extract "myname" out of the line?
thanks (11 Replies)
I'm new to shell scripting and am trying to write a small script that pulls a substring out of a file that has a few lines of text in it. The file will eventually have a lot of text, I just put a few lines in it for testing purposes.
Anyway, this is what I have so far...
#!/bin/ksh
... (4 Replies)
I'd like to print a line if a substring is matched in a case insensitive manner
something like do a case insensitive search for ABCD as a substring:
awk '{ if (substr($1,1,4) == "") print $1 }' infile > outfile
I'm not certain how to make the syntax work???
Thanks (4 Replies)
Hello,
I need to remove a substring from a string in a ksh script, the string is like this:
LOCATION=+DATADG1/CMSPRD1/datafile/system.235.456721
or
LOCATION=/u03/oradata/CMSPRD/SYSTEM.dbf
I need to strip the last file name from that path, and get:
+DATADG1/CMSPRD1/datafile
or,... (8 Replies)
I am new to awk and writing a script using awk. I have file containing fixed length records, I wish to extract 2 substring(each substring is padded with zeros on left e.g 000000003623) and add each substring respectively for every record in the file to get total sum of respective substring for all... (5 Replies)
Hi all,
I need to extract the "abcdef" from the below string Digital_abcdef_20130103.txt.gz
The length of the "abcdef" will be changing but it will be always after the word Digital_ and before the second underscore
help in this regard is highly appreciated (3 Replies)
Hi,
I am new to Unix. I am trying to extract a substring from an input string: Ex -
input string: deploy_v11_9_1
i want to extract and store the value v11_9_1 from the input string in a new variable.
I am using following command in my shell script file:
echo "Enter the folder name u... (5 Replies)
I want to merge the lines by matching substring of the first file with first column of the second file.
file1:
S00739A_ACAGTG_L001_R1.fq.gz
S00739A_ACAGTG_L001_R2.fq.gz
S00739B_GCCAAT_L001_R1.fq.gz
S00739B_GCCAAT_L001_R2.fq.gz
S00739D_GTGAAA_L001_R1.fq.gz
S00739D_GTGAAA_L001_R2.fq.gz... (14 Replies)
Hi,
I have a process that generates strings.
I would like to check each string and search for substring which contains the letter 'E' surrounded by numbers (both sides of the letter 'E').
few examples:
AA4E7012A2 - contains E surrounded by numbers
FE18274012 - does not contain E... (3 Replies)