I have the following line of code that works wonders. I just don't completely understand it as I am just starting to learn regex. Can you help me understand exactly what is happening here?
I'm trying to write a bash script to perform a tedious task, but I have no experience and hardly any knowledge so I've been having a rough time with it.
I'm on Mac OS X, and I want a script to do the following:
I have a directory that has about 200 sudirectories. In each of these directories,... (1 Reply)
Ok, I'm stumped and can't seem to find relevant info.
(I'm not even sure, I might have asked something similar before.):
I'm trying to use shell scripting/UNIX commands to extract URLs from a fairly large web page, with a view to ultimately wrapping this in PHP with exec() and including the... (2 Replies)
I need a way to grep -v a list of times/date from the output of postqueue -p that are a few hours old, in order to remove them with postsuper -d.
Right now I have a script that is deleting the previous day of messages left in the queue, which runs once each day.
I want to clean up the job and... (1 Reply)
On one of my servers, it appears that a bunch of html files got the following code added to it...
I was going to try to remove this line using grep & sed... as sample
grep -lr -e 'apples' *.html | xargs sed -i 's/apples/oranges/g'
I can get the grep portion to work...
grep "<script... (7 Replies)
Hi,
Please help me to understand the bold segments in the below regex.
Both are of same type whose meaning I am looking for.
find . \( -iregex './\{6,10\}./src' \) -type d -maxdepth 2
Output:
./20111210.0/src
In continuation to above:
sed -e 's|./\(*.\{1,3\}\).*|\1|g'
Output: ... (4 Replies)
I'm new using Unix commands in applescript. The following script you choose different folders with PDfs, get file count of PDfs on chosen folders, & write the results in text file.
set target_folder to choose folder with prompt "Choose target folders containing only PDFs to count files" with... (0 Replies)
Hi All,
Facing an issue with grep & sed
I have logs as below:
gsc_1_20121121.log:2012-11-21 10:09:13,143 INFO - fmsspace.1 ProcessNewOrderSingleRequest: Result - ProcessNewOrderSingleBatchResultDTO - success:true,newOrderSingleBatchResults:ProcessNewOrderSingleResultDTO -... (13 Replies)
# echo "Teest string" | sed 's/e*/=>replaced=</'
=>replaced<=Teest string
So, in the above code , sed replaces at the start. does that mean sed using the pattern e* settles to zero occurence ? Why sed was not able to replace Teest string.
# echo "Teest string" | sed 's/e*//g'
Tst string
... (6 Replies)
Hi Guys,
Could you please kindly explain what exactly the below SED command will do ?
I am quite confused and i assumed that,
sed 's/*$/ /'
1. It will remove tab and extra spaces .. with single space.
The issue is if it is removing tab then it should be Î right ..
please assist.... (3 Replies)
Hi everyone,
This regex looks simple and yet it doesn't make sense how it's manipulating the output.
ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:0c:49:c2:35:6v
inet addr:192.16.1.1 Bcast:192.168.226.255 Mask:255.255.255.0
inet6 addr:... (2 Replies)
Discussion started by: xcod3r
2 Replies
LEARN ABOUT PHP
mb_regex_set_options
MB_REGEX_SET_OPTIONS(3) 1 MB_REGEX_SET_OPTIONS(3)mb_regex_set_options - Set/Get the default options for mbregex functions
SYNOPSIS
string mb_regex_set_options ([string $options = mb_regex_set_options()])
DESCRIPTION
Sets the default options described by $options for multibyte regex functions.
PARAMETERS
o $options
- The options to set. This is a string where each character is an option. To set a mode, the mode character must be the last one
set, however there can only be set one mode but multiple options.
Regex options
+-------+-------------------------------+---+---+
|Option | | | |
| | | | |
| | Meaning | | |
| | | | |
+-------+-------------------------------+---+---+
| i | | | |
| | | | |
| | Ambiguity match on | | |
| | | | |
| x | | | |
| | | | |
| | Enables extended pattern form | | |
| | | | |
| m | | | |
| | | | |
| | | | |
| | '.' matches with newlines | | |
| | | | |
| s | | | |
| | | | |
| | | | |
| | '^' -> 'A', '$' -> '' | | |
| | | | |
| p | | | |
| | | | |
| | Same as both the m and s | | |
| | options | | |
| | | | |
| l | | | |
| | | | |
| | Finds longest matches | | |
| | | | |
| n | | | |
| | | | |
| | Ignores empty matches | | |
| | | | |
| e | | | |
| | | | |
| | eval(3) resulting code | | |
| | | | |
+-------+-------------------------------+---+---+
Regex syntax modes
+-----+----------------------------+---+---+
|Mode | | | |
| | | | |
| | Meaning | | |
| | | | |
+-----+----------------------------+---+---+
| j | | | |
| | | | |
| | Java (Sun java.util.regex) | | |
| | | | |
| u | | | |
| | | | |
| | GNU regex | | |
| | | | |
| g | | | |
| | | | |
| | grep | | |
| | | | |
| c | | | |
| | | | |
| | Emacs | | |
| | | | |
| r | | | |
| | | | |
| | Ruby | | |
| | | | |
| z | | | |
| | | | |
| | Perl | | |
| | | | |
| b | | | |
| | | | |
| | POSIX Basic regex | | |
| | | | |
| d | | | |
| | | | |
| | POSIX Extended regex | | |
| | | | |
+-----+----------------------------+---+---+
RETURN VALUES
The previous options. If $options is omitted, it returns the string that describes the current options.
SEE ALSO mb_split(3), mb_ereg(3), mb_eregi(3).
PHP Documentation Group MB_REGEX_SET_OPTIONS(3)