In this post we will discuss how we can retrieve sub string between two words using jQuery in asp.net.
Here let us do inside an asp.net page.
Also you can read:
- Method Overloading in C#.Net
- Convert first letter to uppercase in C#.Net
- Get all time zones in C#.Net
Once you click on the button, you can see the sub string like below:
Here let us do inside an asp.net page.
Also you can read:
- Method Overloading in C#.Net
- Convert first letter to uppercase in C#.Net
- Get all time zones in C#.Net
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#btnGetString").on("click", function () {
var mainString = "This was method to
retrieve sub string between two string here.";
var subString =
mainString.match("was(.*)here");
alert(subString[1]);
});
});
</script>
<br />
<div class="row">
<div class="col-md-4">
<input type="button" id="btnGetString" value="Get sub string between
words" /><br />
</div>
</div>
Once you click on the button, you can see the sub string like below: