Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: separating two sententences

by muba (Priest)
on Sep 16, 2011 at 04:13 UTC ( [id://926298]=note: print w/replies, xml ) Need Help??


in reply to separating two sententences

One thing that's not doing what you want is the if(/("/w+/")/){ line. Let's analyze it.

# if. Nothing weird yet. # | # | Okay. A regex. But where's the ")"? # | | # | | What's this? ;) # | | | # | | | End of condition part. # | | | | # | | | | A random slash # | | | | | # | | | | | A random closing paren. # | | | | | | if( /("/ w+/" ) / ) {

What are those inner slashes doing there anyway?

Replies are listed 'Best First'.
Re^2: separating two sententences
by Anonymous Monk on Sep 16, 2011 at 04:30 UTC

    yes, you are right.i changed it to this but still nothing

    #!/usr/bin/perl -w open IN,"<","file" or die "error opening file: $!"; while(<IN>){ if(/"\(\w+\)"\/){ print "$1\n"; }}
      /"\(\w+\)"\/

      In this regex, the '(' and ')' (parenthesis) characters, which would normally be regex metacharacters marking the start and end of a capture group, are escaped by \ (backslash) characters that return them to being literal '(' and ')' characters. Again, see muba's analysis above Update: ...and reply below. (Missed that last \. Bad case of backslashitis.).

        Not to mention the backslash that escapes the forward slash that's supposed to mark the end of the regex. /...\/ should read /.../.

      You need to reread dreadpiratepeter's node again: Re^5: separating two sententences. Your input file just needs a split on the semicolon to get the two columns, then a regular expression to remove the quotes. Print those out separated by a comma or tab, and then Excel will read the file

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-25 12:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found