Regular Expressions 101

Save & Share

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8
  • .NET 7.0 (C#)
  • Rust
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests

Tools

Sponsors
An explanation of your regex will be automatically generated as you type.
Detailed match information will be displayed here automatically.
  • All Tokens
  • Common Tokens
  • General Tokens
  • Anchors
  • Meta Sequences
  • Quantifiers
  • Group Constructs
  • Character Classes
  • Flags/Modifiers
  • Substitution
  • A single character of: a, b or c
    [abc]
  • A character except: a, b or c
    [^abc]
  • A character in the range: a-z
    [a-z]
  • A character not in the range: a-z
    [^a-z]
  • A character in the range: a-z or A-Z
    [a-zA-Z]
  • Any single character
    .
  • Alternate - match either a or b
    a|b
  • Any whitespace character
    \s
  • Any non-whitespace character
    \S
  • Any digit
    \d
  • Any non-digit
    \D
  • Any word character
    \w
  • Any non-word character
    \W
  • Match everything enclosed
    (?:...)
  • Capture everything enclosed
    (...)
  • Zero or one of a
    a?
  • Zero or more of a
    a*
  • One or more of a
    a+
  • Exactly 3 of a
    a{3}
  • 3 or more of a
    a{3,}
  • Between 3 and 6 of a
    a{3,6}
  • Start of string
    ^
  • End of string
    $
  • A word boundary
    \b
  • Non-word boundary
    \B

Regular Expression

/
/
gm

Test String

Code Generator

Generated Code

use strict; my $str = '<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><getAccountResponse xmlns="http://api.csr.mind.com"><getAccountReturn>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&lt;ns37:response xmlns:ns37=&quot;http://api.csr.mind.com/getAccount&quot; xmlns:c3=&quot;http://api.csr.mind.com/creditCardDetails&quot; xmlns:c1=&quot;http://api.csr.mind.com/account&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;getAccount.xsd&quot;&gt;&lt;c1:account id=&quot;724001&quot;&gt;&lt;c1:code&gt;1499884276&lt;/c1:code&gt;&lt;c1:name&gt;Florin Test Limited2&lt;/c1:name&gt;&lt;c1:type use_own_lc_functionality=&quot;true&quot;&gt;1&lt;/c1:type&gt;&lt;c1:class blocked_selfcare_access=&quot;false&quot; blocked_selfcare_registration=&quot;false&quot; default_selfcare_profile=&quot;&quot; description=&quot;Master&quot; group_code=&quot;MA&quot; type=&quot;3&quot;&gt;1000&lt;/c1:class&gt;&lt;c1:category&gt;0&lt;/c1:category&gt;&lt;c1:group/&gt;&lt;c1:provider code=&quot;EL&quot;/&gt;&lt;c1:parent id=&quot;0&quot;/&gt;&lt; c1:credit_score_consent&gt;false&lt;/c1:credit_score_consent&gt;&lt;c1:credit_score last_change_date=&quot;&quot; last_inquiry_date=&quot;&quot; last_inquiry_score=&quot;&quot;&gt;E&lt;/c1:credit_score&gt;&lt;c1:product code=&quot;MPACK1&quot; type=&quot;&quot;/&gt;&lt;c1:contract length=&quot;0&quot;/&gt;&lt;c1:web_login_name&gt;1499884276&lt;/c1:web_login_name&gt;&lt;c1:web_password&gt;**************************************************************************&lt;/c1:web_password&gt;&lt;c1:web_password_hint/&gt;&lt;c1:tou_accepted&gt;false&lt;/c1:tou_accepted&gt;&lt;c1:participates_in_fub_sharing&gt;true&lt;/c1:participates_in_fub_sharing&gt;&lt;c1:closed_fub_sharing_group&gt;true&lt;/c1:closed_fub_sharing_group&gt;&lt;c1:fub_sharing_group_id&gt;724001&lt;/c1:fub_sharing_group_id&gt;&lt;c1:ivr_password/&gt;&lt;c1:block_ivr&gt;false&lt;/c1:block_ivr&gt;&lt;c1:privacy_level&gt;P&lt;/c1:privacy_level&gt;&lt;c1:note/&gt;&lt;c1:creation_date&gt;20201012&lt;/c1:creation_date&gt;&lt;c1:status&gt;&lt;c1:code&gt;1&lt;/c1:code&gt;&lt;c1:reason description=&quot;Manual active account creation&quot;&gt;12&lt;/c1:reason&gt;&lt;/c1:status&gt;&lt;c1:discount&gt;0.0&lt;/c1:discount&gt;&lt;c1:credit_limit&gt;&lt;c1:limited_credit_class&gt;C&lt;/c1:limited_credit_class&gt;&lt;c1:limited_credit_class_description&gt;C &#x2013; Spending Limit:&lt;/c1:limited_credit_class_description&gt;&lt;c1:limited_credit_type&gt;DEF&lt;/c1:limited_credit_type&gt;&lt;c1:limited_credit_amount&gt;200&lt;/c1:limited_credit_amount&gt;&lt;/c1:credit_limit&gt;&lt;c1:tax&gt;&lt;c1:exemptions&gt;&lt;c1:communication&gt;&lt;c1:federal&gt;false&lt;/c1:federal&gt;&lt;c1:state&gt;false&lt;/c1:state&gt;&lt;c1:county&gt;false&lt;/c1:county&gt;&lt;c1:city&gt;false&lt;/c1:city&gt;&lt;c1:district&gt;false&lt;/c1:district&gt;&lt;/c1:communication&gt;&lt;c1:tax_overrides/&gt;&lt;/c1:exemptions&gt;&lt;c1:location&gt;&lt;c1:geocode&gt;700130070&lt;/c1:geocode&gt;&lt;c1:incorporated_area&gt;true&lt;/c1:incorporated_area&gt;&lt;/c1:location&gt;&lt;/c1:tax&gt;&lt;c1:gl_segment code=&quot;EA6&quot;/&gt;&lt;c1:billing&gt;&lt;c1:billable&gt;true&lt;/c1:billable&gt;&lt;c1:identification_number/&gt;&lt;c1:cycle billing_period_from_date=&quot;20201013&quot; billing_period_to_date=&quot;20201112&quot; description=&quot;Monthly BC 13&quot;&gt;13&lt;/c1:cycle&gt;&lt;c1:split&gt;&lt;c1:amount curr_alpha_code=&quot;CAD&quot;&gt;0&lt;/c1:amount&gt;&lt;c1:paid_by/&gt;&lt;/c1:split&gt;&lt;c1:payment_terms use_provider_default=&quot;true&quot;&gt;&lt;c1:days_from_invoice_generation&gt;21&lt;/c1:days_from_invoice_generation&gt;&lt;/c1:payment_terms&gt;&lt;c1:exclude_from_overdue_handling&gt;false&lt;/c1:exclude_from_overdue_handling&gt;&lt;c1:dc_path_code&gt;default_path_el&lt;/c1:dc_path_code&gt;&lt;c1:participates_in_draft_bc&gt;false&lt;/c1:participates_in_draft_bc&gt;&lt;/c1:billing&gt;&lt;c1:invoice_shipment&gt;&lt;c1:use_provider_settings/&gt;&lt;c1:minimum_amount curr_alpha_code=&quot;CAD&quot;&gt;-1&lt;/c1:minimum_amount&gt;&lt;c1:ship_when_negative_amount&gt;true&lt;/c1:ship_when_negative_amount&gt;&lt;/c1:invoice_shipment&gt;&lt;c1:payment_settings&gt;&lt;c1:bank&gt;&lt;c1:code/&gt;&lt;c1:name/&gt;&lt;c1:branch/&gt;&lt;c1:account&gt;&lt;c1:number/&gt;&lt;c1:holder/&gt;&lt;c1:type/&gt;&lt;c1:method_status&gt;PENDING&lt;/c1:method_status&gt;&lt;c1:routing_number/&gt;&lt;/c1:account&gt;&lt;/c1:bank&gt;&lt;c3:credit_card&gt;&lt;c3:token/&gt;&lt;c3:code/&gt;&lt;c3:number/&gt;&lt;c3:expiration/&gt;&lt;c3:holder/&gt;&lt;c3:start_date/&gt;&lt;c3:card_mode/&gt;&lt;/c3:credit_card&gt;&lt;c1:general&gt;&lt;c1:restrict_check_payments_until_date/&gt;&lt;/c1:general&gt;&lt;/c1:payment_settings&gt;&lt;c1:notification_letters&gt;&lt;c1:notification description=&quot;Not sufficient funds by e-mail&quot; enabled=&quot;true&quot; id=&quot;158&quot;/&gt;&lt;c1:notification description=&quot;Not sufficient funds by sms&quot; enabled=&quot;true&quot; id=&quot;158&quot;/&gt;&lt;c1:notification description=&quot;Debt Collection NL1 SMS&quot; enabled=&quot;true&quot; id=&quot;200&quot;/&gt;&lt;c1:notification description=&quot;Debt Collection NL2 SMS&quot; enabled=&quot;true&quot; id=&quot;201&quot;/&gt;&lt;c1:notification description=&quot;Debt Collection NL3 Mail&quot; enabled=&quot;true&quot; id=&quot;202&quot;/&gt;&lt;c1:notification description=&quot;Order Confirmation Notification&quot; enabled=&quot;true&quot; id=&quot;178&quot;/&gt;&lt;c1:notification description=&quot;Order Shipped Notification&quot; enabled=&quot;true&quot; id=&quot;179&quot;/&gt;&lt;c1:notification description=&quot;Enrollment in preauthorized payment program SMS&quot; enabled=&quot;true&quot; id=&quot;167&quot;/&gt;&lt;c1:notification description=&quot;Credit Card Expired SMS&quot; enabled=&quot;true&quot; id=&quot;173&quot;/&gt;&lt;c1:notification description=&quot;Credit Card Expired Mail&quot; enabled=&quot;true&quot; id=&quot;173&quot;/&gt;&lt;c1:notification description=&quot;Move from limited credit to credit SMS&quot; enabled=&quot;true&quot; id=&quot;177&quot;/&gt;&lt;c1:notification description=&quot;Number porting successful SMS&quot; enabled=&quot;true&quot; id=&quot;168&quot;/&gt;&lt;c1:notification description=&quot;Authentication PIN changed SMS&quot; enabled=&quot;true&quot; id=&quot;165&quot;/&gt;&lt;c1:notification description=&quot;Update Credit Card SMS&quot; enabled=&quot;true&quot; id=&quot;166&quot;/&gt;&lt;c1:notification description=&quot;Password Change SMS&quot; enabled=&quot;true&quot; id=&quot;159&quot;/&gt;&lt;c1:notification description=&quot;Password Change Mail&quot; enabled=&quot;true&quot; id=&quot;159&quot;/&gt;&lt;c1:notification description=&quot;Invoice generated for postpaid account Mail&quot; enabled=&quot;true&quot; id=&quot;28&quot;/&gt;&lt;c1:notification description=&quot;Debt Collection Message 2 Mail&quot; enabled=&quot;true&quot; id=&quot;201&quot;/&gt;&lt;c1:notification description=&quot;Credit Limit Removal Confirmation&quot; enabled=&quot;true&quot; id=&quot;177&quot;/&gt;&lt;c1:notification description=&quot;CC Expiration Threshold 1&quot; enabled=&quot;true&quot; id=&quot;25&quot;/&gt;&lt;c1:notification description=&quot;CC Expiration Threshold 2&quot; enabled=&quot;true&quot; id=&quot;26&quot;/&gt;&lt;c1:notification description=&quot;CC Expiration Threshold 1 Mail&quot; enabled=&quot;true&quot; id=&quot;25&quot;/&gt;&lt;c1:notification description=&quot;CC Expiration Threshold 2 Mail&quot; enabled=&quot;true&quot; id=&quot;26&quot;/&gt;&lt;c1:notification description=&quot;Limited Credit Alerts for SMS&quot; enabled=&quot;true&quot; id=&quot;152&quot;&gt;&lt;c1:parameter value=&quot;50&quot;/&gt;&lt;c1:parameter value=&quot;30&quot;/&gt;&lt;c1:parameter value=&quot;10&quot;/&gt;&lt;/c1:notification&gt;&lt;c1:notification description=&quot;Limited Credit Suspension SMS&quot; enabled=&quot;true&quot; id=&quot;80&quot;/&gt;&lt;c1:notification description=&quot;Document Shipment&quot; enabled=&quot;true&quot; id=&quot;1005&quot;/&gt;&lt;/c1:notification_letters&gt;&lt;c1:shipment&gt;&lt;c1:presentation_format&gt;ELDEFMA&lt;/c1:presentation_format&gt;&lt;c1:ship_email&gt;true&lt;/c1:ship_email&gt;&lt;c1:contact&gt;698198&lt;/c1:contact&gt;&lt;c1:hard_copy_charge&gt;&lt;c1:use_provider_settings/&gt;&lt;c1:type&gt;0&lt;/c1:type&gt;&lt;c1:per_item curr_alpha_code=&quot;CAD&quot;&gt;0&lt;/c1:per_item&gt;&lt;c1:per_page curr_alpha_code=&quot;CAD&quot;&gt;0&lt;/c1:per_page&gt;&lt;/c1:hard_copy_charge&gt;&lt;/c1:shipment&gt;&lt;c1:advanced&gt;&lt;c1:field code=&quot;DEVICE_PROTECTION&quot; label=&quot;Device Protection&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;1&quot;&gt;1499884276&lt;/c1:field&gt;&lt;c1:field code=&quot;ACCT_LANGUAGE&quot; label=&quot;Account Language&quot; mandatory=&quot;true&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;4&quot; valid_values=&quot;English,French&quot;&gt;English&lt;/c1:field&gt;&lt;c1:field code=&quot;COMPLEGAL&quot; label=&quot;Legal Name&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;1&quot;/&gt;&lt;c1:field code=&quot;BUSSALESREP&quot; label=&quot;Business Sales Representative&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;1&quot;/&gt;&lt;c1:field code=&quot;MARKETOFFERSEMAIL&quot; label=&quot;Market Offers Email&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;4&quot; valid_values=&quot;Yes,No&quot;/&gt;&lt;c1:field code=&quot;CHECKREQ&quot; label=&quot;CHECKREQ&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;1&quot;/&gt;&lt;c1:field code=&quot;UPGRADE_ELIGIBLE&quot; label=&quot;Eligible for Upgrade&quot; mandatory=&quot;false&quot; override=&quot;false&quot; override_in_selfcare=&quot;false&quot; type=&quot;4&quot; valid_values=&quot;Yes,No&quot;/&gt;&lt;c1:field code=&quot;AUTHORIZEDOTHER&quot; label=&quot;Authorized other&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;1&quot;/&gt;&lt;c1:field code=&quot;COMMACCTLINK&quot; label=&quot;Commercial Account Link&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;1&quot;/&gt;&lt;c1:field code=&quot;INDIVIDUAL_COUPON_CODE&quot; label=&quot;Individual coupon list&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;1&quot;/&gt;&lt;c1:field code=&quot;SALES&quot; label=&quot;Door to Door / Outbound Sales&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;1&quot;/&gt;&lt;c1:field code=&quot;MATREP&quot; label=&quot;M.A.T Representative&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;1&quot;/&gt;&lt;c1:field code=&quot;NEURAL_RESPONSE&quot; label=&quot;NEURAL_RESPONSE&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;1&quot;/&gt;&lt;c1:field code=&quot;D2DOS&quot; label=&quot;Alternative Sales ID&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;1&quot;/&gt;&lt;c1:field code=&quot;SMSCONTACTPN&quot; label=&quot;Primary Phone number for SMS notification&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;1&quot;/&gt;&lt;c1:field code=&quot;UPGRADE_ACCEPTED&quot; label=&quot;Accepted Upgrade&quot; mandatory=&quot;false&quot; override=&quot;false&quot; override_in_selfcare=&quot;false&quot; type=&quot;4&quot; valid_values=&quot;Yes,No&quot;/&gt;&lt;c1:field code=&quot;NICKNAME&quot; label=&quot;Nickname&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;1&quot;/&gt;&lt;c1:field code=&quot;ELIGIBLEREFUNDCHEQUE&quot; label=&quot;Eligible for refund cheque after final invoice&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;4&quot; valid_values=&quot;Yes,No&quot;/&gt;&lt;c1:field code=&quot;HARDCOPY&quot; label=&quot;Hard Copy&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;4&quot; valid_values=&quot;Y,N&quot;/&gt;&lt;c1:field code=&quot;PROMOTEST&quot; label=&quot;Promo Test&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;4&quot; valid_values=&quot;1,2,3&quot;/&gt;&lt;c1:field code=&quot;CSGACCTNUMBER&quot; label=&quot;CSG Account Number&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;1&quot;/&gt;&lt;c1:field code=&quot;COMPTRADE&quot; label=&quot;Operating Name&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;1&quot;/&gt;&lt;c1:field code=&quot;DEBTHANDLINGSTATUS&quot; label=&quot;Debt handling status&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;4&quot; valid_values=&quot;Pending collections,Sent to collections,No collections,Bankruptcy,Collection Letter&quot;/&gt;&lt;c1:field code=&quot;GLSEGMENTSET&quot; label=&quot;G/L Segment updated based on 1st Service agreement&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;4&quot; valid_values=&quot;Y,N&quot;/&gt;&lt;c1:field code=&quot;CALL_REDIRECT&quot; label=&quot;Call redirect&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;4&quot; valid_values=&quot;On,Off&quot;/&gt;&lt;c1:field code=&quot;IS_REGISTERED&quot; label=&quot;Is registered in Self-Care&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;4&quot; valid_values=&quot;True,False&quot;/&gt;&lt;c1:field code=&quot;MARKETOFFERSCALL&quot; label=&quot;Market Offers Call&quot; mandatory=&quot;false&quot; override=&quot;true&quot; override_in_selfcare=&quot;false&quot; type=&quot;4&quot; valid_values=&quot;Yes,No&quot;/&gt;&lt;/c1:advanced&gt;&lt;c1:contact_list&gt;&lt;c1:contact id=&quot;698198&quot; invoice=&quot;true&quot; primary=&quot;true&quot;&gt;&lt;c1:name&gt;&lt;c1:last&gt;Limited2&lt;/c1:last&gt;&lt;c1:middle/&gt;&lt;c1:first&gt;Florin Test&lt;/c1:first&gt;&lt;c1:company/&gt;&lt;/c1:name&gt;&lt;c1:title/&gt;&lt;c1:gender&gt;0&lt;/c1:gender&gt;&lt;c1:address_type&gt;F&lt;/c1:address_type&gt;&lt;c1:address&gt;&lt;c1:line1&gt;6080 Young St&lt;/c1:line1&gt;&lt;c1:line2/&gt;&lt;c1:line3/&gt;&lt;c1:line4/&gt;&lt;c1:line5/&gt;&lt;c1:line6/&gt;&lt;c1:line7/&gt;&lt;c1:line8/&gt;&lt;c1:line9/&gt;&lt;c1:line10/&gt;&lt;/c1:address&gt;&lt;c1:city&gt;Halifax&lt;/c1:city&gt;&lt;c1:state&gt;Nova Scotia&lt;/c1:state&gt;&lt;c1:zip&gt;B3K 5M3&lt;/c1:zip&gt;&lt;c1:country&gt;CA&lt;/c1:country&gt;&lt;c1:phone&gt;&lt;c1:home/&gt;&lt;c1:business/&gt;&lt;c1:mobile/&gt;&lt;/c1:phone&gt;&lt;c1:fax/&gt;&lt;c1:email&gt;florin.ropota@mindcti.com&lt;/c1:email&gt;&lt;c1:email_list&gt;&lt;c1:email address=&quot;florin.ropota@mindcti.com&quot; main=&quot;true&quot;/&gt;&lt;/c1:email_list&gt;&lt;c1:birthday/&gt;&lt;c1:contact_type&gt;LEGAL&lt;/c1:contact_type&gt;&lt;c1:national_ID/&gt;&lt;c1:identity_type/&gt;&lt;c1:identity_no/&gt;&lt;c1:place_of_birth/&gt;&lt;c1:nationality/&gt;&lt;c1:father_name/&gt;&lt;c1:mother_maiden_name/&gt;&lt;c1:power_of_attorney/&gt;&lt;c1:employer/&gt;&lt;c1:employer_address/&gt;&lt;c1:employer_phone/&gt;&lt;c1:gen_info1 description=&quot;Nickname&quot; visibile=&quot;true&quot;/&gt;&lt;c1:gen_info2 description=&quot;Second ID Type&quot; visibile=&quot;true&quot;/&gt;&lt;c1:gen_info3 description=&quot;Second ID Number&quot; visibile=&quot;true&quot;/&gt;&lt;c1:gen_info4 description=&quot;General contact fourth field&quot; visibile=&quot;false&quot;/&gt;&lt;c1:issuing_country&gt;CA&lt;/c1:issuing_country&gt;&lt;/c1:contact&gt;&lt;/c1:contact_list&gt;&lt;c1:account_balance&gt;&lt;c1:balance curr_alpha_code=&quot;CAD&quot;&gt;-137&lt;/c1:balance&gt;&lt;c1:remaining curr_alpha_code=&quot;CAD&quot;&gt;-57.45&lt;/c1:remaining&gt;&lt;c1:loyalty_points&gt;0&lt;/c1:loyalty_points&gt;&lt;c1:deposit curr_alpha_code=&quot;CAD&quot;&gt;0&lt;/c1:deposit&gt;&lt;c1:disputed_amount curr_alpha_code=&quot;CAD&quot;&gt;0&lt;/c1:disputed_amount&gt;&lt;c1:usage curr_alpha_code=&quot;CAD&quot;&gt;0&lt;/c1:usage&gt;&lt;/c1:account_balance&gt;&lt;c1:balance_threshold_alert&gt;&lt;c1:threshold curr_alpha_code=&quot;CAD&quot;&gt;0&lt;/c1:threshold&gt;&lt;/c1:balance_threshold_alert&gt;&lt;c1:recurring_charges&gt;&lt;c1:disable_automatic_rc&gt;false&lt;/c1:disable_automatic_rc&gt;&lt;/c1:recurring_charges&gt;&lt;c1:selfcare_profile&gt;SELFCAREFULL&lt;/c1:selfcare_profile&gt;&lt;c1:email&gt;florin.ropota@mindcti.com&lt;/c1:email&gt;&lt;c1:web_access&gt;&lt;c1:notification_method&gt;0&lt;/c1:notification_method&gt;&lt;c1:phone_number/&gt;&lt;/c1:web_access&gt;&lt;c1:user_disabled&gt;false&lt;/c1:user_disabled&gt;&lt;c1:selfcare_user_details&gt;&lt;c1:user_must_change_password&gt;false&lt;/c1:user_must_change_password&gt;&lt;c1:password_expiration_date&gt;19700101&lt;/c1:password_expiration_date&gt;&lt;c1:password_never_expires&gt;true&lt;/c1:password_never_expires&gt;&lt;c1:user_disabled_reason&gt;0&lt;/c1:user_disabled_reason&gt;&lt;c1:registered&gt;false&lt;/c1:registered&gt;&lt;/c1:selfcare_user_details&gt;&lt;c1:nearest_billable_account id=&quot;724001&quot;/&gt;&lt;c1:additional_information/&gt;&lt;c1:language&gt;en&lt;/c1:language&gt;&lt;/c1:account&gt;&lt;/ns37:response&gt;</getAccountReturn></getAccountResponse></soapenv:Body></soapenv:Envelope>'; my $regex = qr/c1:account id=&quot;(?<accountID>[^"]*)&quot;&gt;&lt;c1:code&gt;(?<accountCode>[^"]*)&lt;\/c1:code&gt;&lt;c1:name&gt;[^"]*c1:provider code=&quot;(?<providerCode>[^"]*)&quot;\/&gt;&lt;c1:parent id=&quot;(?<parentID>[^"]*)&quot;\/&gt;&lt; c1:credit_score_consent.*?c1:status.*?c1:code&gt;(?<Status>[\d])&lt/mp; if ( $str =~ /$regex/g ) { print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n"; # print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n"; # print "Capture Group 2 is $2 ... and so on\n"; } # ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p' # Named capture groups can be called via $+{name}

Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Perl, please visit: http://perldoc.perl.org/perlre.html