Sponsored Content
Full Discussion: Perl: Regex, string matching
Top Forums Shell Programming and Scripting Perl: Regex, string matching Post 302487404 by fpmurphy on Wednesday 12th of January 2011 10:21:07 AM
Old 01-12-2011
Another option would be to use quotemeta i.e.
Code:
my $userInput = "[latency][info] mpgw(BLUESOAPFramework";
$userInput = quotemeta($userInput);

print "trans usrInput: $userInput\n";
if ( $str =~ m/$userInput/ ) {
   print $str."\n";
}

These 2 Users Gave Thanks to fpmurphy For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

string matching in perl

Hi, I have to search for a string in a variable. Say the variable is var1='ERROR: Make java] as enabled' here i want to match which are in red color. other like abc etc could change. Can you tell me the exact command something like the below in perl if ($var1=~ m/ERROR: Make... (3 Replies)
Discussion started by: ammu
3 Replies

2. Shell Programming and Scripting

Perl regex help - matching parentheses

Let's say I'm trying to match potentially multiple sets of parentheses. Is there a way in a regular expression to force a match of closing parentheses specifically in the number of the opening parentheses? For example, if the string is "((foo bar))", I want to be able to say "match any number of... (7 Replies)
Discussion started by: cvp
7 Replies

3. Shell Programming and Scripting

perl string matching problem (two backslash)

I have a few .tex files generated with html2latex. They have some extra \\ that generate error with pdflatex, so I would like to get rid of them. This perl -p -i -e s/\\\\//g myfile.tex with or without simple or double quote remove all of the backslashes, also the single ones needed by tex. How... (2 Replies)
Discussion started by: ahsog
2 Replies

4. Shell Programming and Scripting

Perl Regex string opperation

I'm working on a basic log parser in perl. Input file looks like: len: 120713 foo bar file size of: testdir1/testdir1/testdir1/testdir1/testfile0 is 120713Of course there are tens of thousands of lines... I'm trying to compare the len and filesize values. #!/usr/bin/perl use strict; use... (2 Replies)
Discussion started by: dkozel
2 Replies

5. Shell Programming and Scripting

Perl REGEX - How do extract a string in a line?

Hi Guys, In the following line: cn=portal.090710.191533.428571000,cn=groups,dc=mp,dc=rj,dc=gov,dc=br I need to extract this string: portal.090710.191533.428571000 As you can see this string always will be bettween "cn=" and "," strings. Someone know one regular expression to... (4 Replies)
Discussion started by: maverick-ski
4 Replies

6. Shell Programming and Scripting

Perl Regex matching multiple lines

I need a way to extract data from X 4T Solution 21 OCT 2011 37 .00 to account 12345678 User1 user2 X 4T Solution Solution Unlimited 11 Sep 2009 248 .00 to account 87654321 user3 user4 I need it to extract 'X' '37.00' and account number 12345678. I have extracted above stuff... (3 Replies)
Discussion started by: chakrapani
3 Replies

7. Shell Programming and Scripting

PERL : pattern matching a string stored in a variable

I have two variables, my $filename = "abc_yyyy_mm_dd.txt"; my $filename1 = " abc_2011_11_07.txt"; I need to perform some operations after checking if $filename has $filename1 in it i have used the below code, if($filename =~ /^$filename1/) { ---- -- } (2 Replies)
Discussion started by: irudayaraj
2 Replies

8. Shell Programming and Scripting

perl regex string match issue..kindly help

i have a script in which i need to skip comments, and i am able to achieve it partially... IN text file: {**************************** {test : test...test } Script: while (<$fh>) { push ( @data, $_); } if ( $data =~ m/(^{\*+$)/ ){ } With the above match i am... (5 Replies)
Discussion started by: avskrm
5 Replies

9. Shell Programming and Scripting

PHP - Regex for matching string containing pattern but without pattern itself

The sample file: dept1: user1,user2,user3 dept2: user4,user5,user6 dept3: user7,user8,user9 I want to match by '/^dept2.*/' but don't want to have substring 'dept2:' in output. How to compose such regex? (8 Replies)
Discussion started by: urello
8 Replies

10. UNIX for Beginners Questions & Answers

Help with understanding this regex in a Perl script parsing a 'complex' string

Hi, I need some guidance with understanding this Perl script below. I am not the author of the script and the author has not leave any documentation. I supposed it is meant to be 'easy' if you're a Perl or regex guru. I am having problem understanding what regex to use :confused: The script does... (3 Replies)
Discussion started by: newbie_01
3 Replies
hx509 name functions(3) 					Heimdalx509library					   hx509 name functions(3)

NAME
hx509 name functions - Functions int hx509_name_to_string (const hx509_name name, char **str) int hx509_name_cmp (hx509_name n1, hx509_name n2) int hx509_parse_name (hx509_context context, const char *str, hx509_name *name) int hx509_name_copy (hx509_context context, const hx509_name from, hx509_name *to) int hx509_name_to_Name (const hx509_name from, Name *to) int hx509_name_expand (hx509_context context, hx509_name name, hx509_env env) void hx509_name_free (hx509_name *name) int hx509_unparse_der_name (const void *data, size_t length, char **str) int hx509_name_binary (const hx509_name name, heim_octet_string *os) int hx509_name_is_null_p (const hx509_name name) int hx509_general_name_unparse (GeneralName *name, char **str) Detailed Description See the PKIX/X.509 Names for description and examples. Function Documentation int hx509_general_name_unparse (GeneralName * name, char ** str) Unparse the hx509 name in name into a string. Parameters: name the name to print str an allocated string returns the name in string form Returns: An hx509 error code, see hx509_get_error_string(). int hx509_name_binary (const hx509_name name, heim_octet_string * os) Convert a hx509_name object to DER encoded name. Parameters: name name to concert os data to a DER encoded name, free the resulting octet string with hx509_xfree(os->data). Returns: An hx509 error code, see hx509_get_error_string(). int hx509_name_cmp (hx509_name n1, hx509_name n2) Compare to hx509 name object, useful for sorting. Parameters: n1 a hx509 name object. n2 a hx509 name object. Returns: 0 the objects are the same, returns > 0 is n2 is 'larger' then n2, < 0 if n1 is 'smaller' then n2. int hx509_name_copy (hx509_context context, const hx509_name from, hx509_name * to) Copy a hx509 name object. Parameters: context A hx509 cotext. from the name to copy from to the name to copy to Returns: An hx509 error code, see hx509_get_error_string(). int hx509_name_expand (hx509_context context, hx509_name name, hx509_env env) Expands variables in the name using env. Variables are on the form ${name}. Useful when dealing with certificate templates. Parameters: context A hx509 cotext. name the name to expand. env environment variable to expand. Returns: An hx509 error code, see hx509_get_error_string(). Only UTF8String rdnSequence names are allowed void hx509_name_free (hx509_name * name) Free a hx509 name object, upond return *name will be NULL. Parameters: name a hx509 name object to be freed. int hx509_name_is_null_p (const hx509_name name) Unparse the hx509 name in name into a string. Parameters: name the name to check if its empty/null. Returns: non zero if the name is empty/null. int hx509_name_to_Name (const hx509_name from, Name * to) Convert a hx509_name into a Name. Parameters: from the name to copy from to the name to copy to Returns: An hx509 error code, see hx509_get_error_string(). int hx509_name_to_string (const hx509_name name, char ** str) Convert the hx509 name object into a printable string. The resulting string should be freed with free(). Parameters: name name to print str the string to return Returns: An hx509 error code, see hx509_get_error_string(). int hx509_parse_name (hx509_context context, const char * str, hx509_name * name) Parse a string into a hx509 name object. Parameters: context A hx509 context. str a string to parse. name the resulting object, NULL in case of error. Returns: An hx509 error code, see hx509_get_error_string(). int hx509_unparse_der_name (const void * data, size_t length, char ** str) Convert a DER encoded name info a string. Parameters: data data to a DER/BER encoded name length length of data str the resulting string, is NULL on failure. Returns: An hx509 error code, see hx509_get_error_string(). Version 1.5.2 11 Jan 2012 hx509 name functions(3)
All times are GMT -4. The time now is 09:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy