Created
October 15, 2014 03:10
-
-
Save vabock/ba0c7accc43dd2958594 to your computer and use it in GitHub Desktop.
2014-10-15 1st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { | |
margin: 0; | |
padding: 0; | |
border: 0; | |
} | |
body { | |
background: #fdf; | |
font: 30px sans-serif; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>ID正規表現変換</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> | |
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script> | |
<!-- Latest compiled and minified JavaScript --> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> | |
</head> | |
<body> | |
<div class="container"> | |
<div class="page-header"> | |
<h1>正規表現エスケープ</h1> | |
</div> | |
<div class="form-group"> | |
<label for="escstr">String:</label> <input class="form-control" name="escstr" id="escstr" value="" /> <br /> | |
<input type="button" class="form-control" name="escape_button" id="escape" value="変換"> | |
</div> | |
</div> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#escape").on "click", () -> | |
$("#escstr").val (idx, value) -> value.replace(/([.?*+^$[\]\\(){}|-])/g, "\\$1") | |
return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment