Regular Expressions 101

Save & Manage Regex

  • Current Version: 1
  • Save & Share
  • Community Library

Flavor

  • PCRE2 (PHP)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java
  • .NET 7.0 (C#)
  • Rust
  • PCRE (Legacy)
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests
Sponsors
There are currently no sponsors. Become a sponsor today!
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
  • Non-capturing group
    (?:...)
  • Capturing group
    (...)
  • 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
Processing...

Test String

Code Generator

Generated Code

$re = '/(?=\[([-0-9\s:]+)\]\s(\w+)\.(\w+):\s(.+))/s'; $str = '[2021-11-20 01:31:44] prodaction.INFO: Был обновлен статус аренды. (PB GetRental) Данные: {"id":2845,"rental_id":"8f93a037-431b-4a64-b211-5be91689cea9","reservation_id":"","country_id":19,"user_id":1644445545,"number":"9105383799","cost":4,"price":8,"free_quota":15,"timeRemaining":"91:10:10","expiration":"2021-11-23T12:41:55.550771-05:00","maxRentalLifetime":"2021-11-23T12:41:54.665765-05:00","autoRenew":0,"emailReminder":true,"status":"Rented","targets":[{"name":"PNC Bank","price":"8","subId":"70e0dd4a-be1c-49f3-bd59-a8ffe412a804","number":"9105383799","targetId":10205,"renewalPrice":{"amount":4,"currency":{"code":"USD","name":"Dollar","symbol":"$","abbreviation":"USD","stringFormat":"{0:#0.00}"}},"dailyFreeQuota":15}],"isNew":null,"provider":"PB","created_at":"2021-11-16 20:42","updated_at":"2021-11-20 01:31:44","autoRenew_bot":0} [2021-11-20 01:31:44] prodaction.INFO: App\\Api\\PhoneBlur::getRentalActivity | Получен ответ: [ { "lineNumber": "9105383799", "lineType": "Temporary Rental", "subscriptionItemId": "70e0dd4a-be1c-49f3-bd59-a8ffe412a804", "payloadDisplayValue": "951500", "fullPayloadValue": "PNC Bank \\nYour passcode is 951500.\\nDon\'t share it with anyone. We also won\'t call and ask for it. If you didn\'t request this passcode, call us at 1-800-762-2035", "isAssignedToSlice": true, "target": { "name": "PNC Bank", "searchKeywords": "PNCBank pnc bank", "description": null, "iconUri": "/static/images/targets/icons/pncbank.png", "targetId": 10205 }, "sentAt": "2021-11-19T17:31:07.153391-05:00", "sentFrom": "32858", "totalRecords": 0, "unfilteredSmsSendingAddOnId": null, "hasUnfilteredSmsSendingAddOn": false }, { "lineNumber": "9105383799", "lineType": "Temporary Rental", "subscriptionItemId": "70e0dd4a-be1c-49f3-bd59-a8ffe412a804", "payloadDisplayValue": "435061", "fullPayloadValue": "PNC Bank \\nYour passcode is 435061.\\nDon\'t share it with anyone. We also won\'t call and ask for it. If you didn\'t request this passcode, call us at 1-800-762-2035", "isAssignedToSlice": true, "target": { "name": "PNC Bank", "searchKeywords": "PNCBank pnc bank", "description": null, "iconUri": "/static/images/targets/icons/pncbank.png", "targetId": 10205 }, "sentAt": "2021-11-18T08:58:33.486598-05:00", "sentFrom": "32858", "totalRecords": 0, "unfilteredSmsSendingAddOnId": null, "hasUnfilteredSmsSendingAddOn": false }, { "lineNumber": "9105383799", "lineType": "Temporary Rental", "subscriptionItemId": "70e0dd4a-be1c-49f3-bd59-a8ffe412a804", "payloadDisplayValue": "553777", "fullPayloadValue": "PNC Bank \\nYour passcode is 553777.\\nDon\'t share it with anyone. We also won\'t call and ask for it. If you didn\'t request this passcode, call us at 1-800-762-2035", "isAssignedToSlice": true, "target": { "name": "PNC Bank", "searchKeywords": "PNCBank pnc bank", "description": null, "iconUri": "/static/images/targets/icons/pncbank.png", "targetId": 10205 }, "sentAt": "2021-11-16T13:42:11.646616-05:00", "sentFrom": "32858", "totalRecords": 0, "unfilteredSmsSendingAddOnId": null, "hasUnfilteredSmsSendingAddOn": false }, { "lineNumber": "9105383799", "lineType": "Temporary Rental", "subscriptionItemId": "70e0dd4a-be1c-49f3-bd59-a8ffe412a804", "payloadDisplayValue": "676482", "fullPayloadValue": "PNC Bank\\nYour passcode is 676482.\\nDon\'t share it with anyone. We also won\'t call and ask for it. If you didn\'t request this passcode, call us at 1-800-762-2035", "isAssignedToSlice": true, "target": { "name": "PNC Bank", "searchKeywords": "PNCBank pnc bank", "description": null, "iconUri": "/static/images/targets/icons/pncbank.png", "targetId": 10205 }, "sentAt": "2021-11-16T12:59:29.093793-05:00", "sentFrom": "76200", "totalRecords": 0, "unfilteredSmsSendingAddOnId": null, "hasUnfilteredSmsSendingAddOn": false }, { "lineNumber": "9105383799", "lineType": "Temporary Rental", "subscriptionItemId": "70e0dd4a-be1c-49f3-bd59-a8ffe412a804", "payloadDisplayValue": "3345572", "fullPayloadValue": "PNC Text Banking\\nYour verification code is 3345572. Please enter this code on the web site to complete the verification.\\nReply HELP for help", "isAssignedToSlice": true, "target": { "name": "PNC Bank", "searchKeywords": "PNCBank pnc bank", "description": null, "iconUri": "/static/images/targets/icons/pncbank.png", "targetId": 10205 }, "sentAt": "2021-11-16T12:43:39.379496-05:00", "sentFrom": "762265", "totalRecords": 0, "unfilteredSmsSendingAddOnId": null, "hasUnfilteredSmsSendingAddOn": false } ]Код: 200HEADERS: {"url":"https:\\/\\/www.phoneblur.com\\/api\\/incoming-temporary-rental-text-messages\\/8f93a037-431b-4a64-b211-5be91689cea9","content_type":"application\\/json; charset=utf-8","http_code":200,"header_size":760,"request_size":732,"filetime":-1,"ssl_verify_result":0,"redirect_count":0,"total_time":0.225958,"namelookup_time":4.7e-5,"connect_time":0.016106,"pretransfer_time":0.059616,"size_upload":0,"size_download":3918,"speed_download":17413,"speed_upload":0,"download_content_length":-1,"upload_content_length":-1,"starttransfer_time":0.22572,"redirect_time":0,"redirect_url":"","primary_ip":"172.67.223.241","certinfo":[],"primary_port":443,"local_ip":"185.250.205.40","local_port":50942,"http_version":2,"protocol":2,"ssl_verifyresult":0,"scheme":"HTTPS"} [2021-11-20 01:42:17] prodaction.INFO: Пользователь пере заказал номер 1807c155-0b8b-4ff3-a042-0a8aa3313e15 по цене 0.1 USD. Пользователю 1966343459 Были сняты средства в размере 0.1 USD.'; preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0); // Print the entire match result var_dump($matches);

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 PHP, please visit: http://php.net/manual/en/ref.pcre.php