+ Reply to Thread
Results 1 to 2 of 2

Thread: Capture anything between Square brackets

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    27

    Capture anything between Square brackets

    My data looks like that :
    Code:
    NYC_ZIP([11511,15764,15444])
    WDC_ZIP([14442,10547,15789])
    ...
    ...
    SO i would like a regex pattern that captures the data between
    those two square brackets "[....]"

  2. #2
    Junior Member
    Join Date
    Jan 2012
    Posts
    36
    Since you're using a capturing group, you can just use $1 after the match succeeds
    Code:
    if($line =~ m/(\[.*\])/)
        print $1;

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts