Sponsored Content
Top Forums Shell Programming and Scripting perl regex string match issue..kindly help Post 302710151 by avskrm on Thursday 4th of October 2012 03:47:56 AM
Old 10-04-2012
my match works fine if the input line has {****************************.....but there is a change in the input line as {* abccd or {*abce...it fails....
I tried to use the match
$data=~/^{\*+([^*]+)?\**$/;
but it throws error saying "Use of uninitialized value in concatenation (.) or string"
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. UNIX for Dummies Questions & Answers

Regex to match when input is not a certain string (can't use grep -v)

Hey everyone, Basically, all I'm looking for is a way to regex for not a certain string. The regex I'm looking to avoid matching is: D222 i.e. an equivalent of: awk '!/D222/' The problem is that I use this in the following command in a Bash script: ls ${source_directory} | awk... (1 Reply)
Discussion started by: kdelok
1 Replies

4. Shell Programming and Scripting

Issues with an exact match using regex in perl!

Hello Guys, I am trying to make an exact match for an email address entered as an argument, using perl, however, it's not working if I put a "$" in the email address. See the below outputs, Correct Match : bash-2.03$ echo sandy@test.com | perl -wln -e 'print if /(^*\@test.com$)/i'... (6 Replies)
Discussion started by: suffisandy
6 Replies

5. Shell Programming and Scripting

Perl: Regex, string matching

Hi, I've a logfile which i need to parse and get the logs depending upon the user input. here, i'm providing an option to enter the string which can be matched with the log entries. e.g. one of the logfile entry reads like this - $str = " mpgw(BLUESOAPFramework):... (6 Replies)
Discussion started by: butterfly20
6 Replies

6. Shell Programming and Scripting

Perl newbie - regex replace all groups issue

Hello, Although I have found similar questions, I could not find advice that could help with my problem. The issue: I am trying to replace all occurrences of a regex, but I cannot make the regex groups work together. This is a simple input test file: The Vedanta Philosophy... (3 Replies)
Discussion started by: samask
3 Replies

7. Shell Programming and Scripting

perl regex issue

Hi, I find it really strange while writing a simple regex to match and print the matched string, dibyajyo@fwtest:~ #perl -e '$x = "root@rashmi>"; print "matched string:$1\n" if ($x =~ /(root@rashmi)/);' matched string:root dibyajyo@fwtest:~ #perl -e '$x = "root@rashmi>"; print... (1 Reply)
Discussion started by: rrd1986
1 Replies

8. Shell Programming and Scripting

Perl:Regex for Search and Replace that has a flexible match

Hi, I'm trying to match the front and back of a sequence. It works when there is an exact match (obviously), but I need the regex to be more flexible. When we get strings of nucleotides sometimes their prefixes and suffixes aren't exact matches. Sometimes there will be an extra letter and... (2 Replies)
Discussion started by: jdilts
2 Replies

9. Shell Programming and Scripting

Print lines that match regex on xth string

Hello, I need an awk command to print only the lines that match regex on xth field from file. For example if I use this command awk -F"|" ' $22 == "20130117090000.*" 'It wont work, I think, because single quotes wont allow the usage of the metacharacter star * . On the other hand I dont know... (2 Replies)
Discussion started by: black_fender
2 Replies

10. Shell Programming and Scripting

Sendmail K command regex: adding exclusion/negative lookahead to regex -a@MATCH

I'm trying to get some exclusions into our sendmail regular expression for the K command. The following configuration & regex works: LOCAL_CONFIG # Kcheckaddress regex -a@MATCH +<@+?\.++?\.(us|info|to|br|bid|cn|ru) LOCAL_RULESETS SLocal_check_mail # check address against various regex... (0 Replies)
Discussion started by: RobbieTheK
0 Replies
Test::Unit::Assertion::Regexp(3pm)			User Contributed Perl Documentation			Test::Unit::Assertion::Regexp(3pm)

NAME
Test::Unit::Assertion::Regexp - Assertion with regex matching SYNOPSIS
require Test::Unit::Assertion::Regexp; my $assert_re = Test::Unit::Assertion::Regexp->new(qr/a_pattern/); $assert_re->do_assertion('a_string'); This is rather more detail than the average user will need. Test::Unit::Assertion::Regexp objects are generated automagically by Test::Unit::Assert::assert when it is passed a regular expression as its first parameter. sub test_foo { ... $self->assert(qr/some_pattern/, $result); } If the assertion fails then the object throws an exception with details of the pattern and the string it failed to match against. Note that if you need to do a 'string does not match this pattern' type of assertion then you can do: $self->assert(qr/(?!some_pattern)/, $some_string) ie. Make use of the negative lookahead assertion. IMPLEMENTS
Test::Unit::Assertion::Regexp implements the Test::Unit::Assertion interface, which means it can be plugged into the Test::Unit::TestCase and friends' "assert" method with no ill effects. DESCRIPTION
The class is used by the framework to provide sensible 'automatic' reports when a match fails. The old: $self->assert(scalar($foo =~ /pattern/), "$foo didn't match /.../"); seems rather clumsy compared to this. If the regexp assertion fails, then the user is given a sensible error message, with the pattern and the string that failed to match it... AUTHOR
Copyright (c) 2001 Piers Cawley <pdcawley@iterative-software.com>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
o Test::Unit::TestCase o Test::Unit::Assertion perl v5.8.8 2006-09-13 Test::Unit::Assertion::Regexp(3pm)
All times are GMT -4. The time now is 06:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy