Hi,
I have to search for a string in a variable.
Say the variable is var1='ERROR: Make java] as enabled'
here i want to match which are in red color. other like abc etc could change.
Can you tell me the exact command something like the below in perl
if ($var1=~ m/ERROR: Make... (3 Replies)
Let's say I'm trying to match potentially multiple sets of parentheses. Is there a way in a regular expression to force a match of closing parentheses specifically in the number of the opening parentheses?
For example, if the string is "((foo bar))", I want to be able to say "match any number of... (7 Replies)
I have a few .tex files generated with html2latex. They have some extra \\ that generate error with pdflatex, so I would like to get rid of them.
This
perl -p -i -e s/\\\\//g myfile.tex
with or without simple or double quote remove all of the backslashes, also the single ones needed by tex.
How... (2 Replies)
I'm working on a basic log parser in perl. Input file looks like:
len: 120713
foo
bar
file size of: testdir1/testdir1/testdir1/testdir1/testfile0 is 120713Of course there are tens of thousands of lines... I'm trying to compare the len and filesize values.
#!/usr/bin/perl
use strict;
use... (2 Replies)
Hi Guys,
In the following line:
cn=portal.090710.191533.428571000,cn=groups,dc=mp,dc=rj,dc=gov,dc=br
I need to extract this string: portal.090710.191533.428571000
As you can see this string always will be bettween "cn=" and "," strings.
Someone know one regular expression to... (4 Replies)
I need a way to extract data from
X 4T Solution 21 OCT 2011 37 .00
to account 12345678 User1 user2
X 4T Solution Solution Unlimited 11 Sep 2009 248 .00
to account 87654321 user3 user4
I need it to extract 'X' '37.00' and account number 12345678.
I have extracted above stuff... (3 Replies)
I have two variables,
my $filename = "abc_yyyy_mm_dd.txt";
my $filename1 = " abc_2011_11_07.txt";
I need to perform some operations after checking if $filename has $filename1 in it
i have used the below code,
if($filename =~ /^$filename1/)
{
----
--
} (2 Replies)
i have a script in which i need to skip comments, and i am able to achieve it partially...
IN text file:
{****************************
{test : test...test }
Script:
while (<$fh>)
{
push ( @data, $_);
}
if ( $data =~ m/(^{\*+$)/ ){
}
With the above match i am... (5 Replies)
The sample file:
dept1: user1,user2,user3
dept2: user4,user5,user6
dept3: user7,user8,user9
I want to match by '/^dept2.*/' but don't want to have substring 'dept2:' in output. How to compose such regex? (8 Replies)
Hi,
I need some guidance with understanding this Perl script below. I am not the author of the script and the author has not leave any documentation. I supposed it is meant to be 'easy' if you're a Perl or regex guru. I am having problem understanding what regex to use :confused: The script does... (3 Replies)
Discussion started by: newbie_01
3 Replies
LEARN ABOUT PHP
mb_convert_encoding
MB_CONVERT_ENCODING(3) 1 MB_CONVERT_ENCODING(3)mb_convert_encoding - Convert character encodingSYNOPSIS
string mb_convert_encoding (string $str, string $to_encoding, [mixed $from_encoding = mb_internal_encoding()])
DESCRIPTION
Converts the character encoding of string$str to $to_encoding from optionally $from_encoding.
PARAMETERS
o $str
- The string being encoded.
o $to_encoding
- The type of encoding that $str is being converted to.
o $from_encoding
- Is specified by character code names before conversion. It is either an array, or a comma separated enumerated list. If
$from_encoding is not specified, the internal encoding will be used. See supported encodings.
RETURN VALUES
The encoded string.
EXAMPLES
Example #1
mb_convert_encoding(3) example
<?php
/* Convert internal character encoding to SJIS */
$str = mb_convert_encoding($str, "SJIS");
/* Convert EUC-JP to UTF-7 */
$str = mb_convert_encoding($str, "UTF-7", "EUC-JP");
/* Auto detect encoding from JIS, eucjp-win, sjis-win, then convert str to UCS-2LE */
$str = mb_convert_encoding($str, "UCS-2LE", "JIS, eucjp-win, sjis-win");
/* "auto" is expanded to "ASCII,JIS,UTF-8,EUC-JP,SJIS" */
$str = mb_convert_encoding($str, "EUC-JP", "auto");
?>
SEE ALSO mb_detect_order(3).
PHP Documentation Group MB_CONVERT_ENCODING(3)