sshnet / sshnet/SSH.NET

Regex match is not greedy

Aperta
#561 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
C#
Stelle
4.4k
Fork
993
Merge medio
9g 21h
PR unite (30g)
1

Descrizione

I am trying to get the pid of my process using Expect using the regex pidof service\\r\\n(\\d+)

It seems that if the service is running and a pid is returned, Expect is able to find it.
But if the service is not running, pidof returns empty so this regex doesn't work.

I changed the regex to pidof service\\r\\n(\\d*) but then it won't find the pid at all and simply returns the string

pidof service

It seems the issue could be that the first line of the incoming string pidof service\r\n would match that regex and Expect returns success and won't process further ?

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Non viene indicato alcun file sorgente, test o punto di ingresso. Inizia individuando la gestione di Expect e regex, quindi riproduci i casi pidof service\r\n per un servizio in esecuzione e uno assente; il lavoro è completato quando il comportamento di matching previsto è coperto da un test di regressione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
networking
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.