Sponsored Content
Full Discussion: Perl regular expression
Top Forums Shell Programming and Scripting Perl regular expression Post 302695337 by durden_tyler on Sunday 2nd of September 2012 10:20:58 PM
Old 09-02-2012
Quote:
Originally Posted by ragilla
...
the output is
--------------
Code:
21/23/3345 2345/43

how is this 2345/43 getting stored in $action[1] array as i have not used () after ram in regular expression...
Your question should be - why is "21/23/3345" showing up in the array @action.
The string " 2345/43" has all the more reason to be there because you substituted "ram" by nothing, thereby chopping it off.

tyler_durden
This User Gave Thanks to durden_tyler For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Regular expression help in perl

Hi all, I am trying to match a multi line string and return the matching string in one line. Here is the perl code that I wrote: #!/usr/bin/perl my $str='<title>My title</title>'; if ($str =~ /(<title>)(+)(<\/title>)/ ){ print "$2\n"; } It returns : My title I want the... (3 Replies)
Discussion started by: sdubey
3 Replies

2. Shell Programming and Scripting

perl regular expression

letz say that my file has 7 records with only one field. So my file has: 11111111 000000000000000 1111 aaaabbbccc 1111111222000000 aaaaaaaa zz All i need is: 1. when the field has a repetition of the same instance(a-z or 0-9), i would consideer it to be invalid.... (1 Reply)
Discussion started by: helengoldman
1 Replies

3. Shell Programming and Scripting

regular expression in perl

hi, i want to extract the sessionID from this line. QnA Session Id : here the output should be-- QnA_SessionID=128589 Thanks NT (3 Replies)
Discussion started by: namishtiwari
3 Replies

4. Shell Programming and Scripting

PERL regular expression

Hello all, I need to match the red expressions in the following lines : MACRO_P+P-_scrambledServices_REM_PRC30.xml MACRO_P+P-_scrambledServices_REM_RS636.xml MACRO_P+P-_scrambledServices_REM_RS535.xml and so on... Can anyone give me a PERL regular expression to match those characters ? ... (5 Replies)
Discussion started by: lsaas
5 Replies

5. Shell Programming and Scripting

Regular expression in Perl

Hi, I need and expression for a word like abc_xyz_ykklm The expresion should indicate that the word starts with abc and end with ykklm but does not contain xyz string in the middle. Example: abc_tmn_ykklm is ok and abc_xyz_ykklm is not Ok. Please help. Regards. (1 Reply)
Discussion started by: asth
1 Replies

6. Shell Programming and Scripting

Perl Regular Expression

Hello, I am trying to use perl LWP module to read and get a specfic URL page. The issue is that the URL ends with the data and time and time is not consistent it changes all the time. if anyone could help me how to write a regular expressin that would work in the LWP::UserAgent get function to... (0 Replies)
Discussion started by: bataf
0 Replies

7. Shell Programming and Scripting

Perl regular expression and %

Could you help me with this please. This regular expression seems to match for the wrong input #!/usr/bin/perl my $inputtext = "W1a$%XXX"; if($inputtext =~ m/+X+/) { print "matches\n"; } The problem seems to be %. if inputtext is W1a$XXX, the regex doesnot match.... (5 Replies)
Discussion started by: suppandi7
5 Replies

8. Shell Programming and Scripting

Hidden Characters in Regular Expression Matching Perl - Perl Newbie

I am completely new to perl programming. My father is helping me learn said programming language. However, I am stuck on one of the assignments he has given me, and I can't find very much help with it via google, either because I have a tiny attention span, or because I can be very very dense. ... (4 Replies)
Discussion started by: kittyluva2
4 Replies

9. Shell Programming and Scripting

Perl regular expression help!

Hi I am doing something basic like... if ($stringvariable =~ /have not typed/) I have a little problem because the 'not' in the expression gets highlighted as a kind of a '!'..what am I supposed to do in this situation? Thank you ---------- Post updated at 03:24 PM ----------... (1 Reply)
Discussion started by: vas28r13
1 Replies

10. Programming

Perl: How to read from a file, do regular expression and then replace the found regular expression

Hi all, How am I read a file, find the match regular expression and overwrite to the same files. open DESTINATION_FILE, "<tmptravl.dat" or die "tmptravl.dat"; open NEW_DESTINATION_FILE, ">new_tmptravl.dat" or die "new_tmptravl.dat"; while (<DESTINATION_FILE>) { # print... (1 Reply)
Discussion started by: jessy83
1 Replies
DIALRULES(5F)															     DIALRULES(5F)

NAME
dialrules - HylaFAX dial string processing rules DESCRIPTION
A dial string specifies how to dial the telephone in order to reach a destination facsimile machine, or similar device. This string is supplied by a user with each outgoing facsimile job. User-supplied dial strings need to be processed in two ways by the HylaFAX server processes: to craft a canonical phone number for use in locating the receiver's capabilities, and to process into a form suitable for send- ing to a modem. In addition client applications may need to process a dial string to formulate an external form that does not include pri- vate information such as a credit card access code. Phone number canonicalization and dial string preparation are done according to dial string processing rules that are located in a file specified in the server configuration file; see the DialStringRules parameter in hylafax-config(5F). The generation of an externalized form for a dial string is done by rules that optionally appear in /usr/lib/fax/dial- rules on client machines. A dial string rules file is an ASCII file containing one or more rule sets. A rule set defines a set of transformation rules that are sequentially applied to a dial string. Each rule set is associated with an identifier, with certain well-known identifiers being used by the facsimile server or client application. Each transformation rule is a regular expression and a replacement string; the regular expres- sion is repeatedly applied to a dial string and any matching substring is replaced by the replacement string. The syntax of a dial string rules file is as follows. Comments are introduced with the ``!'' character and continue to the end of the cur- rent line. Identifiers are formed from a leading alphabetic and any number of subsequent alpha-numeric characters. A rule set is of the form: Identifier := [ rule1 rule2 ... ] where rule1, rule2, and so on are transformation rules. Line breaks are significant. The initial rule set definition line and the trail- ing ``]'' must be on separate lines; and each transformation rule must also be on a single line. Transformation rules are of the form: regular-expression = replacement where regular-expression is a POSIX 1003.2 extended regular expression and replacement is a string that is substituted in place of any por- tion of the dial string that is matched by the regular-expression. White space is significant in parsing transformation rules. If a regu- lar expression or replacement string has embedded white space in it, then the white space needs to be escaped with a ``'' character or the entire string should be enclosed in quote (``"'') marks. Replacement strings may reference the entire string matched by the regular expression with the ``&'' character. Substrings matched with the ``(...)'' constructs may be referenced by using `` '' where n is a sin- gle numeric digit between 1 and 9 that refers to the n-th matched substring; c.f. re_format(7), sed(1), etc. To simplify and parameterize the construction of rule sets, dial string rules files may also include simple text-oriented variable defini- tions. A line of the form: foo=string defines a variable named foo that has the value string. String values with embedded whitespace must use the ``'' character or be enclosed in quote marks. Variables are interpolated into transformation rules by referencing them as: ${var} Note that variable interpolation is done only once, at the time a transformation rule is defined. This means that forward references are not supported and that circular definitions will not cause loops. The facsimile server automatically defines four variables to have the values defined in its configuration file: AreaCode, CountryCode, LongDistancePrefix, and InternationalPrefix These variables are initial- ized before parsing a dial string rules file; thus if they are defined in the rules file then they will override any definition by the server. There are three well known rule set names: CanonicalNumber to convert a dial string to a canonical format, DialString to prepare a dial string before using it to dial the telephone, and DisplayNumber to convert a dial string to an external ``displayable'' form that does not include the private information that might appear in the raw dial string. EXAMPLES
This is the default set of rules for transforming a dial string into a canonical phone number: Area=${AreaCode} ! local area code Country=${CountryCode} ! local country code IDPrefix=${InternationalPrefix} ! prefix for placing an international call LDPrefix=${LongDistancePrefix} ! prefix for placing a long distance call ! ! Convert a phone number to a canonical format: ! ! +<country><areacode><rest> ! ! by (possibly) stripping off leading dialing prefixes for ! long distance and/or international dialing. ! CanonicalNumber := [ %.* = ! strip calling card stuff [abcABC] = 2 ! these convert alpha to numbers [defDEF] = 3 [ghiGHI] = 4 [jklJKL] = 5 [mnoMNO] = 6 [prsPRS] = 7 [tuvTUV] = 8 [wxyWXY] = 9 [^+0-9]+ = ! strip white space etc. ^${IDPrefix} = + ! replace int. dialing code ^${LDPrefix} = +${Country} ! replace l.d. dialing code ^[^+] = +${Country}${Area}& ! otherwise, insert canon form ] The first rule simply strips anything following a ``%''; this will remove any calling card-related information. The next eight rules con- vert upper and lower case alphabetics to the equivalent key numbers (this is convenient for users that use mnemonic phone numbers). The tenth rule removes everything but numbers and plus signs. The eleventh rule translates any explicit international dialing prefix into the ``+'' symbol used to identify country codes. The twelfth rule replaces a leading long distance dialing prefix with the local country code string. The last rule matches local phone numbers and inserts the local country code and area code. As an example, assume that AreaCode=415 CountryCode=1 InternationalPrefix=011 LongDistancePrefix=1 then if the above set of rules is applied to ``01123965-Tube%2345'', the transformations would be: 01123965-Tube%2345 01123965-Tube ! strip calling card stuff 01123965-Tube 01123965-8823 ! convert alphabetics 01123965-8823 011239658823 ! strip white space etc. 011239658823 +239658823 ! replace int. dialing code +239658823 +239658823 ! replace l.d. dialing code +239658823 +239658823 ! otherwise, insert canon form for a final result of ``+239658823''. SEE ALSO
sendfax(1), dialtest(8C), faxq(8C), faxsend(8C), faxgetty(8C), hylafax-config(5F) May 8, 1996 DIALRULES(5F)
All times are GMT -4. The time now is 06:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy