How to extract a string from a larger string?

前端 未结 3 1865
野的像风
野的像风 2021-01-20 17:39

Using jQuery how would I find/extract the \"Spartan\" string if the outputted HTML page had the following..



        
3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-20 17:54

    Regular Expressions. Or by splitting the string in a more tedious fashion.

    Since I'm not a big regex-junkie, I would likely get the text-equivalent using .text(), then split the result on ":", and grab the second index (which would be the 'Spartan' text).

提交回复
热议问题