-1

With Regular Expression Extractor of Jmeter I am trying to get all links or paths from an html document that only relate to the javascript - i.e hrefs that contain ".js" substring. I use next regex expression, but it's get ".css" links too:

href="(.*?)"[^<]

Here is related example of an html fragment:

<head >
<title>TITLE</title><link data-n-head="ssr" rel="icon" type="image/x-icon" href="/favicon.ico"><link rel="preload" href="/_nuxt/app.js" as="script"><link rel="preload" href="/_nuxt/app.js" as="script"><link rel="preload" href="/_nuxt/app.css" as="style"><link rel="preload" href="/_nuxt/app.js" as="script"><link rel="preload" href="/_nuxt/app.css" as="style"><link rel="preload" href="/_nuxt/app.js" as="script"><link rel="stylesheet" href="/_nuxt/app.css"><link rel="stylesheet" href="/_nuxt/app.css">

Can you help me please with right regex that will get only ".js" links and don't get other links that contain ".css" / "svg" and so on?

Skulfinder
  • 23
  • 2

1 Answers1

0

Using regular expressions for parsing HTML is not the best idea, I would rather suggest considering going for CSS Selector Extractor instead.

enter image description here

More information: CSS Selectors Reference

If you want to continue with regular expressions it should be something like href="(.*)\.js

Dmitri T
  • 159,985
  • 5
  • 83
  • 133