Need a valid Regular expression for FQDN file paths RRS feed

  • Question

  • User254389092 posted


    I am working on an application which need to validate a textbox input for FQDN(Fully Qualified Domain Names) file paths of any kind. I tried :



    The second one is almost relevant but did not work. I need a Regular expression for any kind of FQDN file path possible. Please do help me. I could have given an example but not allowed to. Please help me with any kind of possible FQDN file path that validates.


    Friday, September 13, 2019 10:45 AM


  • User-719153870 posted

    Hi Lucifer_deep,

    I think Hostname FQDN validation is what you are looking for.

    The Regular Expression is:


    I built a demo to test it in asp.net:

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <form id="form1" runat="server">
                <asp:TextBox ID="TextBox1" runat="server" AutoCompleteType="Disabled"></asp:TextBox>
                <asp:RegularExpressionValidator ID="RegularExpressionValidator1"
                    ControlToValidate="TextBox1" runat="server" ErrorMessage="Wrong" 

    It worked:

    For more advanced informarion, you can also refer to: Fully qualified domain name validation.

    Hope this would help.

    Best Regard,

    Yang Shen

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 16, 2019 1:55 AM