Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pcre16_get_substring(3) [centos 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)

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)
Man Page

12 More Discussions You Might Find Interesting

1. Programming

can i get a substring from a string?

for example, the string a is "abcdefg", can i get a substring "bcd" (from ato a) from string a? thank you (4 Replies)
Discussion started by: dell9
4 Replies

2. UNIX for Dummies Questions & Answers

How to get the substring from the string

Hi All, Can anybody help me to get the substring from the given string. (3 Replies)
Discussion started by: Anshu
3 Replies

3. Shell Programming and Scripting

Calling a substring from another file

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)
Discussion started by: dcfargo
4 Replies

4. UNIX for Dummies Questions & Answers

Substring not working if more than 1 space

I have a string which is something like this.. abcd efghijkl when I use this using substring() function 2 spaces are bein considered as one starngely. Is there any thing I am doing wroing the input file maintest has the string specified and the code is below while read... (3 Replies)
Discussion started by: prassu
3 Replies

5. Shell Programming and Scripting

Finding longest common substring among filenames

I will be performing a task on several directories, each containing a large number of files (2500+) that follow a regular naming convention: YYYY_MM_DD_XX.foo_bar.A.B.some_different_stuff.EXT What I would like to do is automatically discover the part of the filenames that are common to all... (1 Reply)
Discussion started by: cmcnorgan
1 Replies

6. Shell Programming and Scripting

extracting substring from a file name

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)
Discussion started by: adityamahi
4 Replies

7. Shell Programming and Scripting

Using sed to get a substring

Hi, I have looked all over for this. I am attempting to get a the substring of a string using sed since it seemed the best solution for this. For example my string is: "zzz foo to you and bar123 or foo" I would like to extract the text between "and" and "or" (it could be anything, but... (2 Replies)
Discussion started by: CentaurAtlas
2 Replies

8. Shell Programming and Scripting

How do I pull a substring out of a file?

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)
Discussion started by: enator45
4 Replies

9. Shell Programming and Scripting

PCRE negative lookahead

I have read many tutorials and cannot get this to work. I need to use pcre (because that is what the library in the software we are using uses) and pcregrep everything except /home from the /etc/fstab pcregrep '(?!/home)' /etc/fstab It returns the entire fstab (This is on a RHEL5... (1 Reply)
Discussion started by: insania
1 Replies

10. Shell Programming and Scripting

Help on extracting a substring from the input string

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)
Discussion started by: Pranav Bhasker
5 Replies

11. UNIX for Advanced & Expert Users

Postfix - pcre

Hello. I need to test valid sender address. I have created a rule in main.cf : smtpd_sender_login_maps = pcre:/etc/postfix/sender_login_maps.pcre smtpd_sender_restrictions = reject_non_fqdn_sender, reject_unknown_sender_domain, reject_sender_login_mismatch THe file... (1 Reply)
Discussion started by: jcdole
1 Replies

12. UNIX for Beginners Questions & Answers

Check if string contains substring surrounded by numbers

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)
Discussion started by: yanive
3 Replies