Home >Web Front-end >JS Tutorial >How to get the intermediate value of a string with '' using JS? _javascript skills

How to get the intermediate value of a string with '' using JS? _javascript skills

WBOY
WBOYOriginal
2016-05-16 19:19:281509browse
第一种方法:
var test = "c:\\abc\\123.txt";

alert( test.lastIndexOf( "\\" ) );

一些特殊的字符需要 用 转义字符  "\"       "\\" 就是表示 \         "\"" 表示 "

至于 获取 中间的123 ,你自己来了。
第二中:用正则表达式

[Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn