简体   繁体   English

Javascript模式匹配

[英]Javascript pattern matching

In a string if we know a start point .how to find the end string using js or jquery 在字符串中,如果我们知道一个起点。如何使用js或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

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. 要提供更详细的答案,您需要告诉我们您要从该字符串中提取什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM