function reformat() {
// assign textarea value to a variable
var str = my_text.value;
// lower case
str = str.toLowerCase();
// set textarea value with new value
my_text.value = str;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<div class="container-fluid" style="padding-top:10px;">
<textarea id="my_text" name="my_text" style="width:400px; height:150px;" class="form-control">
select reject_lookup_code "Look Up Code"
, count(*)
from ap_interface_rejections
WHERE reject_lookup_code NOT IN ('THIS','that')
group by reject_lookup_code
</textarea>
<hr />
<button onclick="reformat()">Toggle</button>
</div> <!-- /container-fluid -->
The above code is a simple way to make all text in the textarea lowercase.
Via this question:
Make all lowercase except text between speech marks
Someone kindly confirmed how to use a regular expression in Notepad++ to make all lowercase except text between speech marks (``):
- Find:
'[^']*'|([A-Z]) - Replace With:
(?1\L$1:$0)
I am probably asking for the "moon on a stick" here - but is there a way to achieve the same result using Javascript - except for anything between speech marks (both "" and ``) to not have its case altered?
So that this:
select reject_lookup_code "Look Up Code"
, count(*)
from ap_interface_rejections
WHERE reject_lookup_code NOT IN ('THIS','that')
group by reject_lookup_code
Becomes this:
select reject_lookup_code "Look Up Code"
, count(*)
from ap_interface_rejections
where reject_lookup_code not in ('THIS','that')
group by reject_lookup_code
Thanks