A
A
Alex Alex2018-10-02 17:19:59
Python
Alex Alex, 2018-10-02 17:19:59

PyQt5 Thread and Sqlite(Peewee) how to organize work?

Tell me from the main thread I create additional QThread
and they work with the main thread through the signals and update the data through the pivy,
but apparently when 2 threads start working at once, the program stops
for signals using BlockingQueuedConnection

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
KaktusTeam, 2015-06-05
@TimkaTV

Hello,
In java it will look something like this:

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

    public static void main(String[] args) {
        String content = "В кабинет зашел [id000|Иван Иванов], а там уже сидит [id999|Петр Смирнов]";

        Pattern pattern = Pattern.compile("\\[id([0-9]+)\\|(.*?)\\]");
        Matcher m = pattern.matcher(content);

        StringBuffer sb = new StringBuffer();
        while (m.find()) {
            m.appendReplacement(sb, "<a href=\"vk.com/id$1\">$2</a>");
        }
        m.appendTail(sb);

        String result = sb.toString();
        System.out.println(result);
    }
}

Good luck!

D
Denis Ineshin, 2015-06-05
@IonDen

Well, you can do something like this: jsfiddle.net/IonDen/79e9e9jw

var raw = "В кабинет зашел [id000|Иван Иванов], а там уже сидит [id999|Петр Смирнов]";
console.log(raw);

function clean (text) {
    var r = text.replace(/\[id[0-9]+\|/gi, '');
    r = r.replace(/\]/gi, '');
    return r;
}

var newText = clean(raw);
console.log(newText); // В кабинет зашел Иван Иванов, а там уже сидит Петр Смирнов

A
Andrey Burov, 2015-06-05
@BuriK666

Then already:

var raw = "В кабинет зашел [id000|Иван Иванов], а там уже сидит [id999|Петр Смирнов]";
var clean = raw.replace(/\[id[0-9]+\|(.*?)\]/gi,'$1');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question