Variable can't get full string


(Eleven Yi) #1

I want to match string used regexp, but I can’t get full string, pls see pic, the first pic show truncated string, the second pic show full string

Summary
REG_INITIAL_STATE := `__INITIAL_STATE__=(.*?);\(function\(\)`
	temp := `__INITIAL_STATE__={"aid":"48215316","p":"","videoData":{"aid":48215316,"videos":2,"tid":154,"tname":"三次元舞蹈","copyright":1,"pic":"http:\u002F\u002Fi2.hdslb.com\u002Fbfs\u002Farchive\u002F1ee603353c54cac243a6578c400d490f67ddf69a.jpg","title":"【欣小萌】是你的学妹吗?❤️小鹿乱撞~","pubdate":1554350454,"ctime":1554313004,"desc":"猝不及防地投稿啦!听说很多人押宝新舞是《小鹿乱撞》,你们预感那么准,那我也准点来!\n前段时间,看到好多萌妹子跳了这个舞,撞撞撞,情不自禁,撞撞撞了一下腰哈哈哈\n春天这个季节啊,是真的困倦,在昏昏欲睡的日子里,来个活泼的舞蹈,在操场上蹦跶蹦跶,我最开始配了一条棕色领带,结果拍了之后发现,我这搭配好像便利店的小姐姐呀,临时又回家去换了个色。操场真好,阳光真好,一起开心地跳舞吧!\n接下来是新一轮押宝时间,小萌的下一舞会是?\n\n参考:av38587731\nBGM:小鹿乱撞 永彬Ryan.B\u002F狄迪D-DAY","state":0,"attribute":16768,"duration":136,"rights":{"bp":0,"elec":0,"download":1,"movie":0,"pay":0,"hd5":1,"no_reprint":1,"autoplay":1,"ugc_pay":0,"is_cooperation":0,"ugc_pay_preview":0},"owner":{"mid":8366990,"name":"-欣小萌-","face":"http:\u002F\u002Fi1.hdslb.com\u002Fbfs\u002Fface\u002Fb5aee8b711fd655c70d705678b4e350ae255a1d0.jpg"},"stat":{"aid":48215316,"view":"--","danmaku":"--","reply":2819,"favorite":"--","coin":"--","share":"--","now_rank":0,"his_rank":0,"like":"--","dislike":0},"dynamic":"我翘课来跳舞啦??","cid":84450837,"dimension":{"width":1920,"height":1080,"rotate":0},"no_cache":false,"pages":[{"cid":84450837,"page":1,"from":"vupload","part":"横屏版","duration":68,"vid":"","weblink":"","dimension":{"width":1920,"height":1080,"rotate":0}},{"cid":84451083,"page":2,"from":"vupload","part":"手机竖屏版","duration":68,"vid":"","weblink":"","dimension":{"width":1080,"height":1920,"rotate":0}}],"subtitle":{"allow_submit":false,"list":[]},"embedPlayer":"EmbedPlayer(\"player\", \"\u002F\u002Fs1.hdslb.com\u002Fbfs\u002Fstatic\u002Fplayer\u002Fmain\u002Fflash\u002Fplay.swf\", \"cid=84450837&aid=48215316&pre_ad=\")"},"upData":{"mid":"8366990","name":"-欣小萌-","approve":false,"■■■":"女","rank":"10000","face":"http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Fface\u002Fb5aee8b711fd655c70d705678b4e350ae255a1d0.jpg","DisplayRank":"0","regtime":0,"spacesta":0,"birthday":"","place":"","description":"","article":0,"attentions":[],"fans":1202644,"friend":13,"attention":13,"sign":"谢谢你喜欢如此平凡的我  商务联系QQ1934093435 ","level_info":{"current_level":6,"current_min":0,"current_exp":0,"next_exp":0},"pendant":{"pid":0,"name":"","image":"","expire":0},"nameplate":{"nid":40,"name":"老司机","image":"http:\u002F\u002Fi2.hdslb.com\u002Fbfs\u002Fface\u002F88013f24627e8db0ee3261adf7c8a7d0077c4d4e.png","image_small":"http:\u002F\u002Fi2.hdslb.com\u002Fbfs\u002Fface\u002F075ed5043bdabcbe4f8bc6d730d630cb4b6ade13.png","level":"高级勋章","condition":"直播主播等级\u003E=20级"},"Official":{"role":1,"title":"bilibili 2018百大UP主、高能联盟成员","desc":""},"official_verify":{"type":0,"desc":"bilibili 2018百大UP主、高能联盟成员"},"vip":{"vipType":2,"dueRemark":"","accessStatus":0,"vipStatus":1,"vipStatusWarn":"","theme_type":0},"archiveCount":69},"tags":[{"tag_id":376,"tag_name":"舞蹈","cover":"http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farchive\u002F5c072485a34c9fb638bc5b5558a6b993c91bc704.png","head_cover":"","content":"都是一些舞蹈","short_content":"","type":3,"state":0,"ctime":1436866637,"count":{"view":0,"use":326491,"atten":89775},"is_atten":0,"likes":0,"hates":0,"attribute":0,"liked":0,"hated":0,"showDetail":false,"showReport":false,"timeOut":null},{"tag_id":3212503,"tag_name":"欣小萌","cover":"","head_cover":"","content":"","short_content":"","type":0,"state":0,"ctime":1487295794,"count":{"view":0,"use":834,"atten":1952},"is_atten":0,"likes":3,"hates":0,"attribute":0,"liked":0,"hated":0,"showDetail":false,"showReport":false,"timeOut":null},{"tag_id":1106182,"tag_name":"小鹿乱撞","cover":"","head_cover":"","content":"","short_content":"","type":0,"state":0,"ctime":1436866637,"count":{"view":0,"use":205,"atten":221},"is_atten":0,"likes":3,"hates":1,"attribute":0,"liked":0,"hated":0,"showDetail":false,"showReport":false,"timeOut":null}],"comment":{"count":2819,"list":["打扰了,我没有南开的学妹。。。。。。","打扰了 ~ 我的学妹只活在梦里 ~ 233 . [蛆音娘_滑稽]","阿伟,阿伟!去哪了!在来拍一下“死”戏啊![滑稽]"]},"related":[{"aid":37695875,"cid":66266604,"duration":164,"pic":"http:\u002F\u002Fi2.hdslb.com\u002Fbfs\u002Farchive\u002F1d307d3743b2e2a0007b4c3496e581649c47048a.jpg","title":"【欣小萌】Havana◁◁ 你的细高跟小姐姐上线","owner":{"name":"-欣小萌-","mid":8366990},"stat":{"danmaku":3388,"view":1526294}},{"aid":31246494,"cid":54598586,"duration":206,"pic":"http:\u002F\u002Fi1.hdslb.com\u002Fbfs\u002Farchive\u002Fab6f792705468c688ffe4ae414d8ec2768b5445f.jpg","title":"【欣小萌】女警BAAM❤️今天我要逮捕你!","owner":{"name":"-欣小萌-","mid":8366990},"stat":{"danmaku":3605,"view":1372793}},{"aid":36473657,"cid":64038389,"duration":189,"pic":"http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farchive\u002F39926502f04891d596e5c4f107b8afa5176cb8e4.jpg","title":"欣小萌有点污,到底有多污(∩▽∩)","owner":{"name":"みず酱です","mid":67288895},"stat":{"danmaku":1497,"view":1532890}},{"aid":33068973,"cid":57871437,"duration":214,"pic":"http:\u002F\u002Fi2.hdslb.com\u002Fbfs\u002Farchive\u002F53a776400ae13c0af42d24975e0d6301d984deb2.jpg","title":"【欣小萌】舞蹈串烧 !那些年超火的甜歌,重回学生时代~【原创编舞】","owner":{"name":"-欣小萌-","mid":8366990},"stat":{"danmaku":2036,"view":891862}},{"aid":41569319,"cid":72992970,"duration":166,"pic":"http:\u002F\u002Fi2.hdslb.com\u002Fbfs\u002Farchive\u002Fed04e1bcec979b7070b2d017bffab1602c02712b.jpg","title":"【欣小萌】我又初恋了❤点击一键脱单❤","owner":{"name":"-欣小萌-","mid":8366990},"stat":{"danmaku":1687,"view":936308}},{"aid":35060025,"cid":61418662,"duration":308,"pic":"http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farchive\u002F0e0d51bccbc45c82d2324ab43b64faf7411318bc.jpg","title":"【Kyokyo】万圣节之夜♡Halloween Night♡","owner":{"name":"Kyokyo","mid":475250},"stat":{"danmaku":1153,"view":3161620}},{"aid":15023414,"cid":24470569,"duration":268,"pic":"http:\u002F\u002Fi1.hdslb.com\u002Fbfs\u002Farchive\u002F458798b46b5d09f801bcb1e69d0805f971cdc6df.png","title":"【欣小萌】来自地球最后的告白~","owner":{"name":"-欣小萌-","mid":8366990},"stat":{"danmaku":1598,"view":626969}},{"aid":29013765,"cid":50323789,"duration":246,"pic":"http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farchive\u002Fed980a0b4b95aab376408a040557ad0c0fba7256.jpg","title":"【咬人猫】Fall in Love❤️你的专属小护士 o(*≧▽≦)ツP2竖屏版","owner":{"name":"=咬人猫=","mid":116683},"stat":{"danmaku":7669,"view":2704617}},{"aid":35058317,"cid":61423003,"duration":164,"pic":"http:\u002F\u002Fi1.hdslb.com\u002Fbfs\u002Farchive\u002F7e79a7338f068545cbc29f8f0d72119be46a9e82.jpg","title":"【欣小萌】靠近我!★ 性感人鱼siren ★","owner":{"name":"-欣小萌-","mid":8366990},"stat":{"danmaku":2277,"view":1616968}},{"aid":33962846,"cid":59477410,"duration":310,"pic":"http:\u002F\u002Fi1.hdslb.com\u002Fbfs\u002Farchive\u002F1525bced3fcc42ed9b776fcf7ac578668eb18e13.jpg","title":"【欣小萌】浪人琵琶✿谁陪我浪迹天涯","owner":{"name":"-欣小萌-","mid":8366990},"stat":{"danmaku":6239,"view":2019488}},{"aid":44774355,"cid":78380929,"duration":210,"pic":"http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farchive\u002Fabf104479de0f56c453778c7d83eb4730a528376.jpg","title":"【欣小萌】solo❤只给你的独舞","owner":{"name":"-欣小萌-","mid":8366990},"stat":{"danmaku":2454,"view":1157162}},{"aid":31055163,"cid":54236642,"duration":104,"pic":"http:\u002F\u002Fi2.hdslb.com\u002Fbfs\u002Farchive\u002F11a7959aa7c591a0af74cbc4c462eb39c2e10b7b.jpg","title":"【阿呆】BAAM!商场门口激情蹦迪","owner":{"name":"阿呆每天都不想动","mid":49676},"stat":{"danmaku":1050,"view":1242816}},{"aid":32563775,"cid":56979220,"duration":197,"pic":"http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farchive\u002F8f36660b8ecfc7949167610d564deb2c27190f3c.jpg","title":"【欣小萌】《樱桃小丸子》op♡厦门地标打卡,一起来装嫩!","owner":{"name":"-欣小萌-","mid":8366990},"stat":{"danmaku":2337,"view":1151169}},{"aid":40365721,"cid":70898289,"duration":166,"pic":"http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farchive\u002F7fcb7603f0d341cad1bbe89dbc426ffe6fab3773.jpg","title":"【欣小萌】Good Time◁◁ 好嗨呀,共度好时光","owner":{"name":"-欣小萌-","mid":8366990},"stat":{"danmaku":2067,"view":942770}},{"aid":33673450,"cid":58955422,"duration":250,"pic":"http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farchive\u002F9c3f7eb998f5eb23e7b51d817a4503068e0be82c.jpg","title":"【欣小萌】学习委员♡教室跳舞 YUAN","owner":{"name":"-欣小萌-","mid":8366990},"stat":{"danmaku":1693,"view":892698}},{"aid":46813673,"cid":81997621,"duration":105,"pic":"http:\u002F\u002Fi1.hdslb.com\u002Fbfs\u002Farchive\u002Fd65978e2906dc38e8875359d96a5059c6a959560.jpg","title":"【小米粥】心跳加速了吗 ❤ 对你青睐","owner":{"name":"小米粥好好喝呀qwq","mid":10893225},"stat":{"danmaku":452,"view":363751}},{"aid":47406226,"cid":83017926,"duration":136,"pic":"http:\u002F\u002Fi2.hdslb.com\u002Fbfs\u002Farchive\u002F8f90ef655096b6f9809e3581bebb9cc206b52976.jpg","title":"【楽小漫】❤小鹿乱撞❤","owner":{"name":"楽小漫","mid":378034},"stat":{"danmaku":1905,"view":1472364}},{"aid":45497280,"cid":79808848,"duration":190,"pic":"http:\u002F\u002Fi2.hdslb.com\u002Fbfs\u002Farchive\u002F7a4f374615461d390abf29e45f806c3d92604768.jpg","title":"【小仙若】Babe-球鞋女孩","owner":{"name":"一只小仙若","mid":16539048},"stat":{"danmaku":1074,"view":654090}},{"aid":26192654,"cid":44949958,"duration":228,"pic":"http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farchive\u002F7f7c756669b89a8ec0e592cb6af015b99cdf77e6.jpg","title":"【欣小萌】足球宝贝 ♡ 草地蹦迪BBoom BBoom!","owner":{"name":"-欣小萌-","mid":8366990},"stat":{"danmaku":6318,"view":2371565}},{"aid":40510498,"cid":71147133,"duration":138,"pic":"http:\u002F\u002Fi1.hdslb.com\u002Fbfs\u002Farchive\u002F216071ea2f6ad3b69cfdc5dfcf3ca065dfaadb67.jpg","title":"【小仙若】青春活力兔子舞!","owner":{"name":"一只小仙若","mid":16539048},"stat":{"danmaku":1211,"view":784408}},{"aid":48018393,"cid":84114524,"duration":142,"pic":"http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farchive\u002F924191612972f6a88308c09cc90e093afe920d6d.jpg","title":"【小雪】小鹿乱撞❤你女朋友在跳舞哄你高兴呀喂!","owner":{"name":"小雪_juvia","mid":23400436},"stat":{"danmaku":318,"view":222457}},{"aid":47485440,"cid":83165362,"duration":145,"pic":"http:\u002F\u002Fi1.hdslb.com\u002Fbfs\u002Farchive\u002Fecb64875464cfab488994be151f70504af31e14a.jpg","title":"【乐歌】小鹿乱撞❤想和你约会 ( \u003E﹏\u003C。)","owner":{"name":"乐歌","mid":2337891},"stat":{"danmaku":441,"view":303932}},{"aid":28334347,"cid":49012473,"duration":224,"pic":"http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farchive\u002F67456a5da1007dad91d634e4e6476646b8fb2a01.jpg","title":"【欣小萌】爱你 ♡ 小学晚会金曲回忆杀","owner":{"name":"-欣小萌-","mid":8366990},"stat":{"danmaku":4010,"view":1413370}},{"aid":48296645,"cid":84581240,"duration":201,"pic":"http:\u002F\u002Fi2.hdslb.com\u002Fbfs\u002Farchive\u002Fe518b4856a137d458b9e9f39852fa3014d5d0700.jpg","title":"【古韵】-欣小萌-古风混剪~","owner":{"name":"-雨季有点污-","mid":172941870},"stat":{"danmaku":204,"view":176180}},{"aid":9433959,"cid":15590374,"duration":300,"pic":"http:\u002F\u002Fi1.hdslb.com\u002Fbfs\u002Farchive\u002Ff25277fdbef3ca043b606f55e21a7035394233fa.jpg","title":"【欣小萌】北大未名湖♡爱之诗♡,安全裤不听我的话","owner":{"name":"-欣小萌-","mid":8366990},"stat":{"danmaku":329,"view":108745}},{"aid":47992006,"cid":84065726,"duration":66,"pic":"http:\u002F\u002Fi2.hdslb.com\u002Fbfs\u002Farchive\u002Fb5c29a0a45e55d3fe40725dd2fd90a3ec483d999.jpg","title":"【小初】小鹿乱撞◆不好意思~撞到你了么","owner":{"name":"开门啦你的小初快递","mid":5276},"stat":{"danmaku":236,"view":198811}},{"aid":30184978,"cid":52639719,"duration":188,"pic":"http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farchive\u002F0cca65e7a0f7d402461cff0161492aa450d76ad0.jpg","title":"【欣小萌】肥肉都给你 ♡ 燃烧我的卡路里","owner":{"name":"-欣小萌-","mid":8366990},"stat":{"danmaku":4462,"view":2160497}},{"aid":49294941,"cid":86319395,"duration":132,"pic":"http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farchive\u002F1ad2c0c683bc7350a379d8ad557b5fefc002ba71.jpg","title":"【咖纳】小鹿乱撞 ✪ 后方妹妹出没??","owner":{"name":"咖纳o","mid":6210612},"stat":{"danmaku":150,"view":109185}},{"aid":47300206,"cid":82837086,"duration":206,"pic":"http:\u002F\u002Fi2.hdslb.com\u002Fbfs\u002Farchive\u002Fe743846f0fdf1c89c29838294e2b7b2f1767d5ef.jpg","title":"【尾狐】❀对你青睐❀白裙还是黑衣?想要被你注意~~~","owner":{"name":"尾狐Cc","mid":4683149},"stat":{"danmaku":234,"view":230637}},{"aid":47553131,"cid":83292394,"duration":199,"pic":"http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farchive\u002Fc6a2a20bf0699d198a6d4900587b0d0a9e500f5b.jpg","title":"身材超好超性感的小姐姐经典韩舞","owner":{"name":"嗷嗷嗷嗷嗷---嗷污__","mid":49976984},"stat":{"danmaku":655,"view":573939}},{"aid":47826651,"cid":83773504,"duration":348,"pic":"http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farchive\u002Ff8a56137e510e3508dea90cd3a168bd31e3aa3f6.jpg","title":"欣小萌哭诉遭遇\"渣男\"经历?明知被骗也不后悔,爱到颠覆人生观「萌欣日记20190329-04」","owner":{"name":"欣小萌录屏组","mid":354491760},"stat":{"danmaku":61,"view":38937}},{"aid":47369148,"cid":82959896,"duration":198,"pic":"http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farchive\u002F0e5a809e409b99e7014b75d08193dae186f17fee.jpg","title":"【夏酥酥】Senorita ❤ 双倍的快乐 扭就完事了","owner":{"name":"夏酥酥-A-","mid":4568488},"stat":{"danmaku":336,"view":388894}},{"aid":47224996,"cid":82704583,"duration":142,"pic":"http:\u002F\u002Fi1.hdslb.com\u002Fbfs\u002Farchive\u002F471c8bce74e600d82e6ab9e448a83f0926ad0f21.jpg","title":"【伢伢】看见你我就❤小鹿乱撞❤2P手机竖屏","owner":{"name":"伢伢gagako","mid":632887},"stat":{"danmaku":551,"view":425768}},{"aid":38138807,"cid":67039955,"duration":248,"pic":"http:\u002F\u002Fi2.hdslb.com\u002Fbfs\u002Farchive\u002F271605a7f72e446c118acfaf9661cb8730b65497.jpg","title":"【欣小萌】我在江湖等你 ✿ 乘云归【原创编舞】","owner":{"name":"-欣小萌-","mid":8366990},"stat":{"danmaku":2539,"view":760937}},{"aid":7267152,"cid":13688182,"duration":73,"pic":"http:\u002F\u002Fi1.hdslb.com\u002Fbfs\u002Farchive\u002F51d22efde71ef411839ab8be53bc591eb26e5f22.jpg","title":"【欣小萌】【初投稿】恋爱循环(\u003C_\u003C)","owner":{"name":"-欣小萌-","mid":8366990},"stat":{"danmaku":423,"view":162277}},{"aid":48986000,"cid":85790066,"duration":201,"pic":"http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farchive\u002F77242742bc52f3adbb699667cb63d06928038009.jpg","title":"高二3班流行舞大赛","owner":{"name":"dami119","mid":396918401},"stat":{"danmaku":1219,"view":446535}},{"aid":48252981,"cid":84521975,"duration":176,"pic":"http:\u002F\u002Fi1.hdslb.com\u002Fbfs\u002Farchive\u002F01cabb064e5ed1f1d0ce04a6cb64b2f29061f395.jpg","title":"【小袜子】BABE♡一键换装,双倍快乐","owner":{"name":"小袜子爱雪宝宝","mid":45061078},"stat":{"danmaku":153,"view":185619}},{"aid":48341093,"cid":84611691,"duration":142,"pic":"http:\u002F\u002Fi2.hdslb.com\u002Fbfs\u002Farchive\u002F2c350abb46f93c1dd9b475ffe38517c09f0f603c.jpg","title":"【千夏】想成为你的女友和你约会❤️小鹿乱撞","owner":{"name":"-千夏chika-","mid":13869969},"stat":{"danmaku":95,"view":76293}},{"aid":46956299,"cid":82241996,"duration":134,"pic":"http:\u002F\u002Fi0.hdslb.com\u002Fbfs\u002Farchive\u002F4ec458d2b96beb16d1d160afe49d4db550970269.jpg","title":"【麦麥籽】❤小鹿乱撞❤我想你做我女朋友  ⁄(⁄ ⁄•⁄ω⁄•⁄ ⁄)⁄","owner":{"name":"麦子麦麥籽","mid":848008},"stat":{"danmaku":355,"view":253728}},{"aid":46148392,"cid":80852087,"duration":206,"pic":"http:\u002F\u002Fi2.hdslb.com\u002Fbfs\u002Farchive\u002F41b9d6afc9743f3eae08dfa0c0f4efa6911412c4.jpg","title":"【欣小萌×ilem】勾指起誓(人声本家/专辑《2:3》收录曲)","owner":{"name":"-欣小萌-","mid":8366990},"stat":{"danmaku":2687,"view":504712}}],"isClient":false,"error":{},"player":"","playurl":{},"user":{},"cidMap":{},"insertScripts":["\u002F\u002Fs1.hdslb.com\u002Fbfs\u002Fstatic\u002Fjinkela\u002Fvideo\u002Fstardust-video.d606efa12fd8c5f4d7bdcbcae76ea7815cfba88f.js"]};(function()`
	reg, _ := regexp.Compile(REG_INITIAL_STATE)
	matchStrs := reg.FindStringSubmatch(temp)
	i := 0
	for _, param := range matchStrs {
		if i == 1 {
			var biliModel model.BilibiliModel
			_ = json.Unmarshal([]byte(param), &biliModel)
			fmt.Println("param:", param)
			fmt.Println("Aid:", biliModel.Aid)
		}
		i++
	}


(Norbert Melzer) #2

Sorry, I’m not sure if I understand correctly…

But it seems as if your code works… param contains the matched substring, its printed properly into the terminal…


( Kvaz1r) #3

It would be better to provide minimal code for reproducing the behaviour with expected output.