Skip to main content
Participating Frequently
Apr 29, 2024 7:31 AM UTC
Question

I want to perform a regex match

I want to perform a regex match in such a way that the text should start from # symbol and text should be from a - f and 0 - 9 Eg: #123A34 (hexcode)

    7 replies

    shubhama926776
    Brainy
    Apr 29, 2024 7:56 AM UTC

    Hello [mention:f150d8b666db4f8184c2c73197aeb201:e9ed411860ed4f2ba0265705b8793d05] 

    Can you try this and let me know if that works for you.

    regexmatch("^#[a-fA-F0-9]{6}$", "#123A34")

    शुभम्
    Known Participant
    Jan 2, 2025 12:39 PM UTC

    I want to perform a regex match in such a way that the text should accept only decimal values if any special characters/any invalid decimal should throw error how can we achive this by regex match, Can u please provide sample code?

    stefanhelzle0001
    Brainy
    Jan 2, 2025 1:06 PM UTC

    I copied your text into Chat GPT and got a great answer. Do you want to try that as well?

    Participating Frequently
    Apr 29, 2024 7:58 AM UTC

    Thank you Shubham, it worked

    shubhama926776
    Brainy
    Apr 29, 2024 8:00 AM UTC

    [mention:f150d8b666db4f8184c2c73197aeb201:e9ed411860ed4f2ba0265705b8793d05] I have modified regex for better validation regarding length. You can refer updated one from above.

    शुभम्
    stefanhelzle0001
    Brainy
    Apr 29, 2024 9:14 AM UTC

    This is a great resource.

    https://regex101.com/