Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

115
Visualizações
regex 2 numbers from a string

How can I pull out the 2 numbers in-between Price Our: and the following | from this string?

"Delivery: Price => 30.00 - 45.00 | Price Our: 1900.00 => 1800.00 | Delivery: Contact => 3 - 4 Days | "

I tried (Price Our:.*?(?=\|)) But thats the limit of my regex knowledge

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

You could use 2 capture groups:

\bPrice Our: (\d+(?:\.\d+)?) => (\d+(?:\.\d+)?) \|

The pattern matches:

  • \bPrice Our: A word boundary to prevent a partial match, then match Price Our:
  • (\d+(?:\.\d+)?) Capture group 1, match a number with an optional decimal part
  • => Match literally
  • (\d+(?:\.\d+)?) Capture group 2, match a number with an optional decimal part
  • \| Match |

Regex demo

const s = "Delivery: Price => 30.00 - 45.00 | Price Our: 1900.00 => 1800.00 | Delivery: Contact => 3 - 4 Days | ";
const regex = /\bPrice Our: (\d+(?:\.\d+)?) => (\d+(?:\.\d+)?) \|/;
const match = s.match(regex);

if (match) {
  console.log(match[1]);
  console.log(match[2]);
}

In case the digits are at the end of the string, and there is no | following, you can account for that using an alternation to assert the end of the string:

\bPrice Our: (\d+(?:\.\d+)?) => (\d+(?:\.\d+)?)(?: \||$)

Regex demo

about 4 years ago · Juan Pablo Isaza Relatório

0

(\d*\.\d+)

regex101 explanation:

enter image description here

const regex = /(\d*\.\d+)/gm;
const str = "Delivery: Contact => 3 - 4 Days | Price Our: 1900.00 => 1800.00 | Delivery: Contact => 3 - 4 Days | ";

const res = str.match(regex)

console.log(res)

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda