Похожие чаты

Hey, does somebody know, can regexp fail only because of

the big length of input string (my string is a little bigger than 800k symbols)?
str := "somestring \"text\":[`somestring`,] somestring"
reg := regexp.MustCompile("\"text\":\\[`(.*?)`,\\]")
match := reg.FindStringSubmatch(sbody)
fmt.Println(match[1])
This example works correctly, but when I change str with real string with 800k symbols, i have this error
goroutine 1 [running]:
main.main()
Path/to/directory/main.go:24 +0x19f

Process finished with the exit code 2
If i am wrong, what can be cause of this error?

4 ответов

12 просмотров
boost::regex- Автор вопроса

If in this example, with one actual match, this work correctly, why it fail with the big string? So, answer to your question, is more no, than yes I may be wrong

boost::regex
If in this example, with one actual match, this wo...

Instead of printing a single element (match[1]), try printing the whole thing fmt.Printf("%v\n", match ). match could be empty or have only 1 element.

boost::regex- Автор вопроса
eme
Instead of printing a single element (match[1]), t...

Okay this is worst than phantom error. I do some debug, and there really nil in match. I write wrong regex, and I don't know why

boost::regex
Okay this is worst than phantom error. I do some d...

Lesson learned to never just use a slice without length checking it first :P

Похожие вопросы

Обсуждают сегодня

а зачем этот вопрос для удаления из чата?
Mёdkinson Medvezhkin
63
using next image component with s3 image: "url" parameter is valid but upstream response is invalid code: <Image fill src={s...
Fasil
3
Эх кто-то пришел и весь праздник испортил :( You need complex FBX scene importing setup to change things on import? good luck with that. You need navigation and pathfinding? g...
Serg Gini
5
Friends, how can I find my Wazirx wallet address?
Silm Silm
31
Всем привет! Подскажите. Я написал приложение на Delphi 10.2 Tokyo под Windows 10. И передо мной стал вопрос о том чтобы сделать это приложение кроссплатформенным (под Linux и...
Дмитрий Завгородний
24
Какого хера? /Sources/App/Modules/User/Models/UserLinkApple.swift:21:20: warning: stored property '_id' of 'Sendable'-conforming class 'UserLinkApple' is mutable @ID(...
Alexander Sherbakov
14
My 7 year old daughter recognizes the Bitcoin symbol and knows it's currency. What are the top ,3-5 most basic important concepts to convey to a kid about BCH? I started with ...
Big Hair
24
How the price of ANVL is decided? The buying pressure comes just from staking which is very slow, while the selling pressure might be huge. What are the benefits for those who...
MJ Javvaji @muralijavvaji
13
How many Cashfusion server now?
Crypto life
22
Кто знает локации, где можно машину красиво отфоткать?
Lalalashechki Lalala
23
Карта сайта