You could:
use strict; use warnings; my $tempStr = <<'STR'; sdfasdfsdfsd asdfasdfasdfasdfsdfsd ... is_raw_sql_editor = FALSE" STR open my $inFile, '<', \$tempStr; local $/ = "\n\n"; # Break input into paragraphs while (<$inFile>) { chomp; next unless length; next unless / User\s+(\w+).*? phone\s*=\s*(\w*).*? email\s*=\s*(\w*).*? misc_info\s*=\s*(.*) /xs; print "User $1, phone $2, email $3, misc_info:\n$4\n\n"; }
Prints:
User soandso, phone , email a, misc_info: is_superuser = TRUE is_appbuilder = TRUE is_packagehacker = FALSE is_user_maint = TRUE authentication = CQ is_dynamic_list_admin = FALSE is_public_folder_admin = FALSE is_security_admin = FALSE is_raw_sql_editor = FALSE User soandso1, phone , email a, misc_info: is_superuser = TRUE is_appbuilder = TRUE is_packagehacker = FALSE is_user_maint = TRUE authentication = CQ is_dynamic_list_admin = FALSE is_public_folder_admin = FALSE is_security_admin = FALSE is_raw_sql_editor = FALSE"
which scales nicely to obtaining the input from a file.
In reply to Re: regexp parsing from a big string...
by GrandFather
in thread regexp parsing from a big string...
by dani_cv
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |