- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
brennson90
Path Finder
11-23-2021
12:07 AM
Hi everyone,
i got two URLs which i want to represent in one regex group. The dest Port (443) will be in a seperate group
Here are two examples.
my.url.is.here:443
http://myurl.de/tasks/search/home?
When i use the following regex "(?<url>[^\s:]+):?" the first example is fine, but the second only catches "http" because it only matches till the ":"
Can someone help and fix my regex?
Thanks.
1 Solution
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
brennson90
Path Finder
11-23-2021
04:31 AM
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
brennson90
Path Finder
11-23-2021
04:31 AM
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
brennson90
Path Finder
11-23-2021
12:46 AM
Hi @ITWhisperer thx for the reply. Now the first number of the dest port is lost.
It captures everything till "my.url.is.here:4"
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ITWhisperer

SplunkTrust
11-23-2021
01:05 AM
Please provide the SPL you are using (in a code </> block preferably)
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
brennson90
Path Finder
11-23-2021
01:43 AM
I'm not 100% sure what you want to see.
This is my search
index=mysearch
| rex "\s(?<url>.+)(:\d|\?)(?<dest_port>\d+)?\s+"
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ITWhisperer

SplunkTrust
11-23-2021
12:25 AM
If you don't mind losing the ?, you could use
"(?<url>.+)(:\d|\?)"
