views:

27

answers:

1

In a string if we know a start point .how to find the end string using js or jquery

   var helper="$var_1__ee$var_2__ee";

    $var is the starting point and the end string pattern is ee

  How to split the string based on this pattern
A: 

Regular expressions will be useful here

helper.match(/$var[^$]*ee/)

To provide a more detailed answer you need to tell us what are you trying to extract from this string.

Adam Byrtek
@Adam:The matched string should be replaced with $glob__l__ee
Rajeev
I still don't have a clear picture of what you're trying to do, but this might be useful `helper.replace(/$var[^$]*ee/, "$glob__l__ee")`
Adam Byrtek