Hello Friends,
i am new bee of Perl developemnt., can you pls give regular expression for this number.,

input: (232,45,3434,535.56) like wise (\()([0-9.,]+)(\))

output: -232,45,3434,535.56

Thanks Advance..,
Senthil. V

first you want \. not .
second you don't need capture group parens around the parens
third, what you are missing is the replacement string, which would simply be - and the first capture group, of course (since there should only be one capture group).

$string = '(232,45,3434,535.56)';

$string =~ s/\(         # match '(' character
            (           # start group1
             [\d\.,]+   # match digit, dot, comma '1 to many' times
             )          # end group 1
             \)         # match ')' character
	     /-$1/x;    # retain the group1
                        # 'x' modifier Allows the white space for
                        # coommenting 

print $string;

thanks Manimuthu

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.