• Regexp for html forms

    From saito@saitology9@gmail.com to comp.lang.tcl on Thu Jul 31 18:11:18 2025
    From Newsgroup: comp.lang.tcl

    Is there a regexp to parse out all inputs from an html form? Ideally it
    will give out the input field names and their values. If nothing ready
    is available, would regexp be a good choice here?


    <form action="/process.php">
    <label for="fname">First name:</label><br>
    <input type="text" id="fname" name="fname" value="John"><br>
    <label for="lname">Last name:</label><br>
    <input type="text" id="lname" name="lname" value="Doe"><br><br>
    <input type="submit" value="Submit">
    <input ...>
    </form>

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From saito@saitology9@gmail.com to comp.lang.tcl on Thu Jul 31 19:00:35 2025
    From Newsgroup: comp.lang.tcl

    On 7/31/2025 6:11 PM, saito wrote:
    Is there a regexp to parse out all inputs from an html form?  Ideally it


    Please ignore. I found something that I can work with.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Fri Aug 1 07:58:15 2025
    From Newsgroup: comp.lang.tcl

    Am 01.08.2025 um 01:00 schrieb saito:
    On 7/31/2025 6:11 PM, saito wrote:
    Is there a regexp to parse out all inputs from an html form?  Ideally it


    Please ignore. I found something that I can work with.

    tdom is your friend. Now also for JSON.
    It also translates all the &uuml; etc...

    Harald
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Rich@rich@example.invalid to comp.lang.tcl on Fri Aug 1 15:18:41 2025
    From Newsgroup: comp.lang.tcl

    Harald Oehlmann <wortkarg3@yahoo.com> wrote:
    Am 01.08.2025 um 01:00 schrieb saito:
    On 7/31/2025 6:11 PM, saito wrote:
    Is there a regexp to parse out all inputs from an html form? 
    Ideally it


    Please ignore. I found something that I can work with.

    tdom is your friend. Now also for JSON.
    It also translates all the &uuml; etc...

    Yes, best to use a proper HTML/XML parser. While one can craft a regex
    to "parse" one specific given HTML form, it is impossible to write a
    regex that will parse any given HTML form.

    https://codica.dev/read/why-regex-fails-at-parsing-html-and-what-to-do-instead-1f4ace53

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From saito@saitology9@gmail.com to comp.lang.tcl on Fri Aug 1 13:41:45 2025
    From Newsgroup: comp.lang.tcl

    On 8/1/2025 11:18 AM, Rich wrote:
    Harald Oehlmann <wortkarg3@yahoo.com> wrote:

    tdom is your friend. Now also for JSON.
    It also translates all the &uuml; etc...

    Yes, best to use a proper HTML/XML parser. While one can craft a regex
    to "parse" one specific given HTML form, it is impossible to write a
    regex that will parse any given HTML form.

    Thank you both! Learned something useful about tdom in the process.
    --- Synchronet 3.21a-Linux NewsLink 1.2