Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Parsing a Word placed between special characters

by Laurent_R (Abbot)
on May 01, 2013 at 18:52 UTC ( #1031631=note: print w/replies, xml ) Need Help??

in reply to Parsing a Word placed between special characters

I guess the OP must have change the original post, since I do not see any square bracket in the original post right now.

The line now look like this


As it is now, I would suggest the following (assuming the explored string is in the $_ special variable):

$name = $1 if /test\\(\w+)\\test/;

But I am not sure that the description of the original string is really adequate.

Replies are listed 'Best First'.
Re^2: Parsing a Word placed between special characters
by davido (Archbishop) on May 01, 2013 at 19:02 UTC

    If someone posts \[abc\] without <code> tags, everyone will see \abc\. What's unclear to me is if the backslashes are significant or not.


      I agree, the input is unclear.
        Thanks to everyone who responded. The query was in fact obscure since I didn't use the <code> tag. Please find the query in a proper format below.

        I have a file called names.txt with the following content

        I was trying to extract the initials placed between special characters  [ and ] and output this to a new file initials.txt as



        I hope that I have clarified the question. Thanks once again to those who guided me the correct regex. Regards, PS.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1031631]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2016-10-27 06:59 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (353 votes). Check out past polls.