I have thousands of HTML tags, as it is written:
& lt; Input type = "text" name = "customer name" />
& lt; Input type = "text" name = "SalesOrder" />
I need to match each name
attribute value and change them to do this:
CustomerName -> Cust [customer_name]
Sales Order -> Cust [sales_order]
will result in:
& lt; Input type = "text" name = "cust [customer_name]" />
& lt; Input type = "text" name = "cust [sales_order]" />
My best effort is stuck in this method: name = \ "[a-zA-Z0- 9] * \"
- > Just name = "customer name"
Thanks in advance.
something like that?
& lt; Php $ theme = & lt; & Lt; & Lt; EOT & lt; Input type = "text" name = "customer name" /> & Lt; Input type = "text" name = "sales order" /> EOT; $ Pattern = '/ \\ bname = ["\'] ([A-Za-z0- 9] +) [" \ '] /'; $ Output = preg_replace_callback ($ pattern, function ($ match) {return ''. 'Name = "cust ['. Strtolower (preg_replace ('/ (? & Lt; = [az]) ([AZ]) /', '_ $ 1', $ match [1])). '] "';}, $ Theme); ? & Gt; & Lt; Pre & gt; & Lt ;? Php echo heittens ($ output) ;? & Gt; & Lt; / Pre & gt;
The output looks like this:
& lt; Input type = "text" name = "cust [customer_name]" /> & Lt; Input type = "text" name = "cust [sales_order]" />
Comments
Post a Comment