0
votes
0answers
21 views

Saltstack regular expression to target all except

I'm having trouble using regex with salt to target every minion except one. I have tried every example I can find and exhausted my limited understanding of Perl regex. I expect this to target every ...
-1
votes
2answers
33 views

Converting Perl Regex to PHP [closed]

I have the following Regex in PERL which I need to convert to PHP if($line =~ m/[<]div class="row.* id="(vm_[0-9]{8,9})"[>]/i){ } I currently have the following in PHP to match it, but I'm ...
0
votes
1answer
23 views

What regex pattern would I have to use to parse out unwanted characters in this format?

#!/usr/bin/perl POSIX qw(strftime); my $time = strftime("%YT%mT%d TTTT%H:%M", localtime); print ("Todays date and time is $time\n"); I am a little rusty at regex, what would be a pattern to search ...
3
votes
2answers
126 views

How to comment out multiple line matching a regex using sed or awk

I have a file that contains this: [...] location /static { ... multiple lines ... } [...] location /static/ { ... multiple lines ... } [...] And I want to get: [...] # ...
0
votes
0answers
85 views

How to pipe regex with ffmpeg and perl?

So I am trying to get the current frame of the conversion with this bash command: ffmpeg -i fd.mp4 fd.avi < /dev/null 2>&1 | perl -015 -e 'print <STDIN>=~/frame=(\ {3})(\d+)/' | sed ...
0
votes
2answers
227 views

Regex for unix paths

What would be the correct perl regex for detecting only Unix paths? ./dir1/dir2/file.ext - invalid ./dir1/dir2/ - valid ./dir1/dir2 - valid
2
votes
3answers
287 views

matching start of the line in cygwin regexp

I apply sed 's/^ bug*/__/' to ref bug bug ref and get ref __ __ ref The same is responded for perl, perl -ni -e 's/^ bug/__/; print'. Sample file can be downloaded ...
1
vote
1answer
312 views

Add, replace or delete something/everything between two strings with regexxer

I'm using regexxer to translate an application that use .php files. In accordance to the webpage it's based on usage and syntax of Perl regular expressions. It looks more to be applied to Perl code. ...
0
votes
1answer
136 views

Converting between a vim replace and a perl pie replace

So I have a file test.txt, that contains, home -> range If I edit the file in vim and run the command %s/^\(.*\)->\(.*\)$/\2 ::= \1 ;/g it converts the file to range ::= home ; which is ...
0
votes
1answer
333 views

Linux replace ^M$ with $ in csv

I'm working on migrating from MDaemon to Google Apps. As part of this process I'm exporting the contacts and calendars for all of our users into CSV files then reading them into a perl script and ...
1
vote
2answers
1k views

Perl for matching with regex in Terminal?

I'm trying to familiarize myself a little with perl to use for regex searches in Terminal (Mac). Now, I'm not really looking to learn Perl rigourously, just trying to find out how to do some simple ...
9
votes
5answers
2k views

Removing ANSI color codes from text stream

Examining the output from perl -e 'use Term::ANSIColor; print color "white"; print "ABC\n"; print color "reset";' in a text editor (e.g., vi) shows the following: ^[[37mABC ^[[0m How would one ...
1
vote
3answers
357 views

SW to replace a string in Windows

I have a text file (actually XML) that I want to be able to change using a command line. In other words, as part of a Windows batch, I want to locate a string (in this case @@@@, which uses a ...
2
votes
2answers
765 views

How to make «grep -P “foo (b.r)”» display only what's in the brackets? Do I need perl?

I have a large file, and I'm trying to get all matches of a regular expression from it. grep -P "foo (b.r)" Displays all the lines containing «foo b.r», and I'd like to display only what's inside of ...
8
votes
4answers
2k views

Can I use perl regular expressions in the vim command line?

I want to use perl regular expressions on the vim command line. For example, to capitalize the words on the current line, you could type: :s/(\w+)/\u$1/g