Need perfact Regular Expression [closed] - regex

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need to extract information form a text using regex for statements like bellow
#1. 02/14/2013 05:21 pm - Safee Safeeul Bashir
- Status changed from New to In Progress
#2. 02/14/2013 10:43 pm - Safee Safeeul Bashir
- Status changed from In Progress to Resolved
- CL set to 1203474
#3. 08/16/2013 02:30 am - Mondal Amit Kumar
Task was automatically close beacuse last update was more than two months and the issue passed
From here I want to extract the date and time where the status is changed to resolve.
For example for this one the date with #2 **02/14/2013 10:43 pm**

How about this:
\d\d/\d\d/\d{4}\s\d\d:\d\d\s[ap]m(?=.*(\n?\r?).*Resolved)
See it on RegExr

The regex can be
\d{2}/\d{2}/\d{4}\s\d{2}:\d{2}\s[pa]m

Related

Conditional Regex for Percentage based values [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed last year.
Improve this question
I've never been very good at regex, but I really need to grab the percentage information from these log entries; however, the warn/critical message moves around depending on where the warning was located in either the In or the Out utilization. I just can't figure out the regex. Here are two example entries that show both in and out issues:
["XXXXXXX"], (up), MAC: XX:XX:XX:XX:XX:XX, Speed: 2 GBit/s, In: 0 Bit/s (0%), Out: 6.53 GBit/s (warn/crit at 1.6 GBit/s/1.8 GBit/s) (326.45%)(!!)
["XXXXXXX"], (up), MAC: XX:XX:XX:XX:XX:XX, Speed: 2 GBit/s, In: 0 Bit/s (warn/crit at 1.6 GBit/s/1.8 GBit/s) (95.45%), Out: 6.53 GBit/s (32.00%)(!!)
Ultimately I need to use capture groups to capture both the in and out utilization percentage. But every regex I try only finds a single percentage. Help on this would be greatly appreciated. Thanks in advance.
EDIT SHOWING EXPECTED RESULT:
for each line the regex capture groups would identify in and out so the program can see both the in and out utilization. The program is expecting a key value pair from every log entry like the following:
IN:0% OUT:326.45%
IN:95.45% OUT:32.00%
Do you need something like this?
In:.+\(([0-9\.]+%)\).+Out:.+\(([0-9\.]+%)
If you just need to pull out values with percentage information, then it can help
https://regex101.com/r/B9pZeO/1

Regex for matching items from firewall syslog [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I am trying to come up with a regex to extract certain pieces of information from the below log. I've been messing with regex groups for awhile and am not getting anywhere. I would like to get the date/timestamp, the usr field, dstname field, and arg field. How can I accomplish this?
May 1 08:21:02 192.168.1.1 id=firewall sn=fakeserial time="2020-05-01 12:21:02 UTC" fw=1.2.3.4 pri=3 c=4 m=14 msg="Web site access denied" app=2515 sess="Auto" n=398533 usr="sampledomain\username" src=192.168.1.150:50334:X0 dst=72.21.81.240:80:X1 srcMac=b0:00:b4:18:4a:b5 dstMac=c0:ea:e4:9d:a0:8c proto=tcp/http dstname=ctldl.windowsupdate.com arg=/msdownload/update/v3/static/trustedr/en/disallowedcertstl.cab code=99 Category="Administrative Custom List settings" fw_action="drop"
You could base it on something like this
(\w{3} \d* [\d:]*).*usr="([a-z\\]*)".*dstname=([\w.]*).*arg=([\/][^ ]*)
https://regex101.com/r/VUIBAm/1

Why lone line in fortran code in one part is highlighted and become like comment? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm trying to write a fortran code for 1 phase flow in porous media.
In discretized equations and other long line I have a below problem as you see in the picture.
After that highlighted phrase my code become like comment.
Can anyone help me?
According to this:
In its current state, the syntax highlighting for fixed-form Fortran in the extension only supports a line length of 72 characters. Anything after column 72 appears as comments (green) in the source code, which also affects the appearance of the following lines (when a closing parenthesis is in this green region for example)
You can change it on fortran_fixed-form.tmLanguage.json file or on the VS code settings.

Notepad++ find and replace after specific character [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I have hundred of song lyric database files, and I need to do something like this,
from this :
PPK4: B'rilah Hormat Pada Hu
Judul Inggris: Glory to God in the Highest
Lagu: unknown Syair: unknown
1=A, 4/4
to become like this :
PPK4: B'rilah Hormat Pada Hu
B'rilah Hormat Pada Hu
Judul Inggris: Glory to God in the Highest
Lagu: unknown Syair: unknown
1=A, 4/4
PPK4 is a song number. so, there will be like PPK1 until PPK255, KPPK1 .. KPPK300 etc.
and same format, "#songcode" ":" "(space)" "song title" "CRLF"
How do I do it using Find and Replace?
The answer involves regular expressions.
You could try "([A-Z]+[0-9]+[:])(.*)"
This will capture the song number as group 1 and the song title as group 2. You can then replace this with "\1\2\n\2", i.e. group 1 followed by group 2, a newline and group 2 again.

Replace Specific Instance [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I'm completely new to RegEx and could really use some help with my delimma. I have a large text file of IP addresses and corresponding Hosts.
eg.
157.55.33.47 msnbot-157-55-33-47.search.msn.com
157.56.93.62 msnbot-157-56-93-62.search.msn.com
etc...
I need a find and replace algorithm that apeends to the beginning and end of each line and replaces the delimeter, which in this case is just a space.
eg. the ouput after running the regex should be
'text1' 157.55.33.47 'text2' msnbot-157-55-33-47.search.msn.com 'text3'
'text1' 157.56.93.62 'text2' msnbot-157-56-93-62.search.msn.com 'text3'
Any guidance would be greatly appreciated!
Find what:
^([\S]+)\s([\S]+)$
Replace with:
'text1' $1 'text2' $2 'text3'
You can use a Macro for this instead of a regex. Record keystrokes on the first line. I'm on a Mac right now, so I can't be sure this is right, but it should be close to:
Home, [type 'text1'], CTRL+RightArrow [repeat 7 times], [type 'text2],
space, End, space, [type 'text3'], DownArrow
Once your Macro is recorded, re-run your Macro for the entire file. Again, I can't see the exact options, but it will be something like the following:
Go to Macros>Run a Macro Multiple Times..., select Current recorded macro, and Run until the end of file.