{"inline_daily":{"regex-tester-explainer":{"0_or_1_occurrence_optional":"0 or 1 occurrence (optional)","0_or_more_occurrences":"0 or more occurrences","1_or_more_occurrences":"1 or more occurrences","any_digit_0_9":"Any digit (0-9)","any_whitespace_character_space_tab_newline":"Any whitespace character (space, tab, newline)","any_word_character_a_za_z0":"Any word character [a-zA-Z0-9_]","capture_groups":"Capture groups:","capture_groups_breakdown":"Capture Groups Breakdown","capturing_group_1_2":"Capturing group ($1, $2...)","case_insensitive":"Case insensitive","character_set_class":"Character set / class","chars":"chars","copied":"Copied!","copy_js_snippet":"Copy JS Snippet","dot_matches_newline":"Dot matches newline","end_of_string_line":"End of string/line","flags":"Flags :","found":"found","french_phone_number":"French Phone Number","hex_color_code":"Hex Color Code","invalid_regex_syntax":"Invalid regex syntax","ipv4_address":"IPv4 Address","iso_date_yyyy_mm_dd":"ISO Date (YYYY-MM-DD)","live_match_highlights":"Live Match Highlights :","match":"match","match_all_instances":"Match all instances","matches":"matches","matches_3_or_6_digit_hex":"Matches 3 or 6 digit hex color codes","matches_french_mobile_and_landline_numbers":"Matches French mobile and landline numbers","matches_http_https_web_links_with":"Matches HTTP/HTTPS web links with query parameters","matches_standard_email_addresses_with_tld":"Matches standard email addresses with TLD","matches_valid_ipv4_addresses_from_0":"Matches valid IPv4 addresses from 0.0.0.0 to 255.255.255.255","multiline_mode":"Multiline mode","no_match_found_for_this_pattern":"No match found for this pattern.","non_capturing_group":"Non-capturing group","paste_your_test_string_here":"Paste your test string here...","pattern_cannot_be_empty":"Pattern cannot be empty","pattern_token_analysis":"Pattern Token Analysis","quick_regex_presets":"Quick Regex Presets","regular_expression_pattern":"Regular Expression Pattern","replacement_pattern_1_2_supported":"Replacement pattern ($1, $2, $& supported)","resulting_string":"Resulting String :","standard_iso_8601_date_with_capture":"Standard ISO 8601 date with capture groups for year, month, day","start_of_string_line":"Start of string/line","substitution_replace_tool":"Substitution / Replace Tool","test_string":"Test String","unicode_support":"Unicode support","valid_email":"Valid Email","web_url_http_https":"Web URL (HTTP/HTTPS)","word_boundary":"Word boundary","default_test_text":"Contact contact@kristools.com or dev.team@example.org for any technical question.\nAlso visit https://kristools.app or contact@startup.io!","sample_email":"Contact info: test@kristools.com, admin@domain.co.uk, invalid@email","sample_url":"Check out https://kristools.app and http://example.org/page?query=1#section","sample_phone":"Call 06 12 34 56 78 or +33 1 42 68 55 00 to confirm.","sample_date":"Appointment from 2026-08-25 to 2026-12-31, invalid date: 2026-13-40.","sample_ip":"Servers: 192.168.1.1, 10.0.0.254, 127.0.0.1 (invalid: 999.300.1.1)","sample_hex":"Palette: #FFF, #3B82F6, #10B981, #6366F1, invalid: #GG123","replacement_error":"Replacement error: {{message}}","match_tooltip":"Match #{{n}} ({{length}} chars, index {{index}})","pattern_placeholder":"e.g. [a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,}","replacement_placeholder":"e.g. $1","match_number":"Match #{{n}}","position_line":"pos: [{{start}}, {{end}}] ({{length}} chars)","uuid_v4":"UUID v4","html_tag":"HTML tag","copy_result":"Copy output","sample_uuid":"Identifier: 95ed6328-7bf5-4baa-82b0-2471c40a847d","sample_html":"

Welcome to the site

\nWrite to us\n"}},"docs_daily":{"tools":{"regex_tester_explainer":{"content":{"title":"Understanding a regex: capture groups, $1 and replacement","intro":"Each pair of parentheses in a regular expression captures part of the match, numbered from left to right ($1, $2…), which the replacement can reuse. The tool highlights matches in the text, breaks down the captured groups of each one, names the syntax elements found in the pattern and gives you the equivalent JavaScript code.","details":"

Capture groups in practice

The default pattern ([a-zA-Z0-9._%+-]+)@([a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}) holds two groups: $1 captures the part before the at sign, $2 the domain. On the sample text, with the gi flags, the tool finds 3 addresses; for contact@kristools.com, $1 is contact and $2 is kristools.com. The replacement [$1 at $2] gives [contact at kristools.com]. A group that starts with (?: groups without capturing and gets no number.

Example: turning ISO dates into day/month/year

The ISO date preset captures year, month and day in three groups. On its sample sentence it keeps 2026-08-25 and 2026-12-31 and skips 2026-13-40, an impossible month. The replacement $3/$2/$1 produces 25/08/2026 and 31/12/2026.

What the tool shows

The eight presets (email, URL, French phone number, ISO date, IPv4 limited to 0-255, hex colour, UUID v4, HTML tag) also load a matching sample text.

Limits

To mask emails, UUIDs or tags in a text, load the matching preset, type the replacement text and copy the output with the button above the resulting string.

"}},"regex-tester-explainer":{"faqs":[{"question":"How do I use $1 and $2 in a regex replacement?","answer":"$1 inserts the text captured by the first pair of parentheses and $2 by the second, counting opening parentheses from left to right. With the default pattern and the replacement [$1 at $2], contact@kristools.com becomes [contact at kristools.com]. $& inserts the whole match."},{"question":"What is the difference between (...) and (?:...)?","answer":"(...) captures text and gives it a reusable number ($1, $2…). (?:...) only groups, for instance to apply a quantifier to several characters, without creating a numbered group. Turning an unneeded group into (?:...) keeps the numbering of the following groups unchanged."},{"question":"How do I convert a YYYY-MM-DD date to DD/MM/YYYY with a regex?","answer":"Capture the three parts with \\b(\\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])\\b and replace with $3/$2/$1. 2026-08-25 becomes 25/08/2026, while 2026-13-40 is skipped because there is no month 13. Day 31 is still accepted for every month, so 2026-02-31 goes through."},{"question":"Does the copied JavaScript code work as is?","answer":"For most patterns, yes: the tool copies const regex = /pattern/flags; and then text.match(regex). If the pattern contains an unescaped forward slash, the literal becomes invalid, so write \\/ instead of /. With the g flag, match returns the list of matches without groups; use matchAll to get them."},{"question":"Why does my regex find only one match?","answer":"The g (global) flag is probably off. Without it, JavaScript stops at the first match, for searching and for replacing alike. Turn g on to get every occurrence."},{"question":"Which regex matches a French phone number?","answer":"The built-in pattern is (?:(?:\\+|00)33|0)\\s*[1-9](?:[\\s.-]*\\d{2}){4}. It matches both 06 12 34 56 78 and +33 1.23.45.67.89: a +33, 0033 or 0 prefix, one digit from 1 to 9, then four pairs of digits optionally separated by spaces, dots or hyphens."},{"question":"How do I mask every email address in a text with a regex?","answer":"Load the email pattern, keep the g flag on and type [EMAIL HIDDEN] in the replacement field. On the sample text it loads, the 2 complete addresses are replaced and invalid@email, which has no domain extension, stays as it is. The copy button grabs the resulting text."},{"question":"Does the IPv4 pattern check that an IP address is valid?","answer":"Yes, for the range of each octet: the pattern repeats the alternation 25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]? four times, which keeps every number between 0 and 255. 192.168.1.50 matches, 999.300.1.1 does not. It does not tell you whether the address is private or public."}]}}}}