- 論壇徽章:
- 0
|
本帖最后由 david_95 于 2015-07-01 18:08 編輯
有文本文件內容如下:
item_package_dimensions: [
{
length: {
normalized_value: {
unit: inches,
value: 10.599999989188,
},
unit: centimeters,
value: 26.924,
},
width: {
normalized_value: {
unit: inches,
value: 10.49999998929,
},
unit: centimeters,
value: 26.67,
},
height: {
normalized_value: {
unit: inches,
value: 1.699999998266,
},
unit: centimeters,
value: 4.318,
},
source_customer_id: 120098015,
},
],
manufacturer: [
{
value: "Hasbro Games",
language_tag: zh_CN,
},
],
。。。 下面還有很多類似字符串
我想搜索匹配item的相應內容 ,比如我搜“width”,從“:{”開始 ,讀取其下所有的字符串,直到遇到對應的“}”為止
問題:
1 我可以用正則匹配找到第一個 width, 我怎么定位到該行,并從該行開始繼續(xù)讀入
2 我怎么找到對應的結束符 }
腦子轉不動了,求指點 |
|