I have about 1,000 lines of html that look like this:
<input type="text" readonly value="some-value-here" class="unit size1of2" />
I am able to find all of those lines using the RegEx search of
<input type="text" readonly value="[^<]+" class="unit size1of2" />
However, I am trying to change all of them to
<input type="hidden" value="same-value-that-was-found" />
Any ideas on what I need to do to accomplish this?
Related
I have a HTML form which currently has unique id's for each input (or select) like so.
example 1
<input type="number" id="qty-a-row" min="0" max="999" autocomplete="off" value="" style="border:0px; outline:0px; display:inline-block; width:50px;" />
example 2
<select id="ps_a_row" autocomplete="off" style="width:324px; border:0px; outline:0px; display:inline-block">
each id is unique. I'm now trying to add in a name="" with the same value as every id="" found so example 1 above becomes.
<input type="number" id="qty-a-row" name="qty-a-row" min="0" max="999" autocomplete="off" value="" style="border:0px; outline:0px; display:inline-block; width:50px;" />
and example 2 becomes...
<select id="ps_a_row" name="ps_a_row" autocomplete="off" style="width:324px; border:0px; outline:0px; display:inline-block">
and so on for every id="anything" it finds.
I'm using notepad++ and with regex ticked currently trying...
Find = id="(.*)"
Replace = id="\1" name="\1"
but this is only finding some id's and duplicates all other tags it finds after the id it finds too.
The complete code for the form I'm trying to edit is here...
https://pastebin.com/ZAE4Gffk
Find id="([^"]+)" and replace it with id="\1" name="\1" , but you shouldnt use regex for HTML manipulation. Use appropriate tools for that.
Demo
I am trying to search a string in eclipse.
<input type="text" autocomplete="off" />
<input type="text" sacsacdfsre />
I want to search all input elements of type text and exclude elements with autocomplete.
Search input and text and exclude autocomplete
I am trying
input.*text.*^(autocomplete)
how can we solve this.
Try something like this:
<input[^>]+type="text"(?![^>]*autocomplete).*?>
Working example on RegexPal
I have an input text box in my HTML form which looks for a regex pattern as shown below.
I am looking for anything to be entered other than white spaces or blank. I tried all the following below and none of them is allowing me to enter any normal text such as "hello world" and "helloworld" in it.Any suggestions are most welcome. Thanks
<input name="item" type="text" size="25" autofocus="autofocus" pattern="^\S$" title="Enter something valid"/>
<input name="item" type="text" size="25" autofocus="autofocus" pattern="^[^\s]*$" title="Enter something valid"/>
<input name="item" type="text" size="25" autofocus="autofocus" pattern="^[\S]*$" title="Enter something valid"/>
EDIT:
after removing the anchor, this works for "helloworld" but not for "hello world". So I think it has to do with regex pattern.
<input name="item" type="text" size="25" autofocus="autofocus" pattern="[^\s]*" title="Enter something valid"/>
[^\s]* will match against anything that contains no spaces, so a space in the words will not match.
You probably want something like .*[^\s].* to match a string with at least one non-space character.
The required attribute is probably the best way to guard against blanks (or ^$ should work).
In coldfusion, in the hidden values of a form I get two values:
<input type="hidden" name="EST_VAL" value="#EST_VAL#" />
<input type="hidden" name="DOWN_PMT" value="#DOWN_PMT#" />
I need to find the value of EST_VAL subtracted from DOWN_PMT and assign it to this value:
<input type="hidden" name="LOAN_VAL" value="#LOAN_VAL#" />
I know how to do this in PHP, but I'm not sure if I should use a cfset, or cffunction in coldfusion.
you can do this inline with pound signs like so:
<input type="hidden" name="LOAN_VAL" value="#EST_VAL-DOWN_PMT#"/>
CFSET should be all you need for this. Without seeing the other code in this file/script, a simple approach/solution would entail the following:
<cfset LOAN_VAL = EST_VAL - DOWN_PMT />
That would then output the value of the LOAN_VAL variable in the hidden field tag you note in your original post.
Thank you for taking the time to look at my post.
I have an input tag that i need to have output-ed like so:
<input type="hidden" name="success_redirect" value="http://www.webpage.com?var1=${root/option1}&var2=${root/option2}" />
but i cant get that into my xslt document without it eventually rendering to
<input type="hidden" name="success_redirect" value="http://www.webpage.com?var1=$&var2=$" />
What do i put in the XSLT to allow me to get that value tag to output like i need it to?
Thanks!
Just use:
<input type="hidden" name="success_redirect"
value="http://www.webpage.com?var1=${{root/option1}}&var2=${{root/option2}}" />
Do note that if we want to output a '{' or a '}' in an attribute, we have to double them.
This is because these two characters have special meaning when used inside an attribute: they indicate the start and end of an AVT (attribute-value-template).
You can concatenate the parts:
<input type="hidden" name="success_redirect"
value="{concat('http://www.webpage.com?var1=${','root/option1}','&var2=${','root/option2}')}" />