N
N
NubasLol2019-06-14 17:12:32
go
NubasLol, 2019-06-14 17:12:32

How to find the always correct statement?

How to find the always correct statement?
For example 1=1 , 1 = 1, ''=''

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
VicTHOR, 2019-06-14
@NubasLol

([^,\s]+?)\s?=\s?\1
only full match I don't know the go
language for functions, but something like this: 1) Divide into groups (?P[^,\s]+ ?)\s?=\s?(?P[^,\s]+) 2) Get the group ${a} and the group ${b} for comparison

str := "1=1, 1=2, 1 = 1, '' = '', 3 = f"
reg := regexp.MustCompile("(?P<a>[^,\s]+?)\s?=\s?(?P<b>[^,\s]+)")
match := reg.FindAllString(str, -1)

probably such a beginning, then in match there should be groups ${a} and ${b} and they need to be taken out and compared in turn, I don’t know the backend, but you can’t write on pure regular expressions in Go .

D
Dimonchik, 2019-06-14
@dimonchik2013

enumeration

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question