Skip to main content
April 29, 2024
Question

I want to perform a regex match

  • April 29, 2024
  • 7 replies
  • 0 views

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
    April 29, 2024

    Hello [mention:f150d8b666db4f8184c2c73197aeb201:e9ed411860ed4f2ba0265705b8793d05] 

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

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

    January 2, 2025

    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
    January 2, 2025

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

    April 29, 2024

    Thank you Shubham, it worked

    shubhama926776
    April 29, 2024

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

    stefanhelzle0001
    April 29, 2024

    This is a great resource.

    https://regex101.com/