CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [rovf] regex help: Edit Log



robertico
Novice

Mar 22, 2013, 5:36 AM


Views: 1225
Re: [rovf] regex help

I'll give you an example;


Code
some useless text {"to_id": 0, "message": "This is a sample", "message_id": 1000, "from_id": 999} more useless text {"to_id": 1, "message": "This is a sample", "message_id": 1000, "from_id": 999} and more 
some useless text {"to_id": 3, "message": "*This is a sample", "message_id": 1000, "from_id": 999} more useless text {"to_id": 4, "message": "This is a sample", "message_id": 1000, "from_id": 999} and more


For line one I need both parts between the curly braces;
Expected result;


Code
{"to_id": 0, "message": "This is a sample", "message_id": 1000, "from_id": 999}  
{"to_id": 1, "message": "This is a sample", "message_id": 1000, "from_id": 999}


For line two I only need one part (Not the part with the ' * ')

Expected result;


Code
{"to_id": 4, "message": "This is a sample", "message_id": 1000, "from_id": 999}



(This post was edited by robertico on Mar 22, 2013, 5:50 AM)


Edit Log:
Post edited by robertico (Novice) on Mar 22, 2013, 5:50 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives