Author:
erics, February 11th, 2021
## to add a single backslash in front of whatever char was matched
|
my $password = q#abc'A1r%Fgt&jh[-#; $password =~ s/(['])/\\$1/g; print qq#'$password'\n#; 'abc\'A1r%Fgt&jh[-' |
## to double whatever char was matched
|
my $password = q#abc'A1r%Fgt&jh[-#; $password =~ s/(['])/$1$1/g; print qq#'$password'\n#; 'abc''A1r%Fgt&jh[-' |
## to convert ‘ to ‘\” for shell execution
|
my $password = q#abc'A1r%Fgt&jh[-#; $passwordShell =~ s/(['])/$1\\$1$1/g; print qq#'$password'\n#; 'abc'\''A1r%Fgt&jh[-' |
Categories: How-To's, Technology Tags: Backslash, Characters, double, double quotes, Escape, howto, perl, quote, quotes, Replace, Single, single quotes, Speci, Special, Special character, Substitute, tips
| No comments
Author:
erics, January 11th, 2012
You must use all three lines together for it to work…YMMV:
|
$escaped = str_replace(chr(10),'\n',$original_value); $escaped = str_replace(chr(13),'\r',$escaped); $escaped = preg_replace("/(\r?\n)/","\n",$escaped); |
Categories: How-To's, Technology Tags: Backslash, break, carriage return, control-m, Escape, javascript, JS, line break, Newline, php, Return
| No comments
Author:
erics, April 25th, 2011
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
// // set options in advance for re-use later // the helper function takes the place of: // helper: 'clone', // and now assigns the clone to a variable // so we can cancel it later with the escape key // var dragOptions = { helper: function() { draggedClone = jQuery(this).clone(); return draggedClone; }, revert:'invalid', snap: true, snapMode: 'inner', containment: "#wrapper" }; jQuery(document).ready(function() { // // do these things after the document is fully loaded // // attach the draggable feature to the desired element jQuery('.draggable').draggable(dragOptions); // capture the escape ket to cancel the drag via the keyboard jQuery(document).keyup(function(e) { if (e.keyCode == 27) { draggedClone.trigger("mouseup"); return false; } }); }); |
Categories: How-To's, Technology Tags: Draggable, Escape, Escape key, JQuery, jQuery UI
| No comments
Author:
erics, April 25th, 2011
|
jQuery(document).keydown(function(e) { if (e.keyCode == 27) { alert('ESCAPE Pressed'); } // esc if (e.keyCode == 13) { alert('ENTER Pressed'); } // enter if (e.keyCode == 9) { alert('TAB Pressed'); } // tab var tagName = jQuery(this).find(':focus').get(0).tagName; //if (tagName == 'INPUT') return false; }); |
Categories: How-To's, Technology Tags: Cancel, Escape, Escape key, JQuery, keycode, keypress, keyup
| No comments