in reply to Re: regex replace problem
in thread regex replace problem

thank you Fisher and JavaFan ,i mean such as tbgl_translate(...) ---> translate_gl(...)
your code works with many words,sample of that converted words inside htm files such as:
href="SetMaterialSpecular_gl.htm">SetMaterialSpecular_gl
CLASS="f_Code_Keyword">SetMaterialSpecular_gl
but i have found that some words does not converted, it is in htm files not text , the not converted words like this inside the htm files:
CLASS="f_Code_Keyword">TBGL_SetMaterialDiffuse( hMaterial, R, G, B )
i want to replace TBGL_SetMaterialDiffuse(...) by
SetMaterialDiffuse_gl(...)
and so on for other words
my code until now using javaFan regex:
$file = "TBGL_SetMaterialDiffuse.htm"; open(FILE, $file) || die $!; $txt = do { local $/; <FILE> }; close FILE; $txt =~ s/tbgl_(\pL+)/${1}_gl/g; open FILE, ">output.htm" or die $!; print FILE $txt; close FILE;
thanks

Replies are listed 'Best First'.
Re^3: regex replace problem
by JavaFan (Canon) on Nov 18, 2010 at 15:32 UTC
    See, that's what you get from not specifying your problem, and just giving an example that doesn't cover all the cases. You got an answer to your described problem, and now you have to come back with "well, really, the problem I described wasn't really the problem I'm trying to solve. In fact, this is the problem....".

    Use /i. For details, RTFM.

Re^3: regex replace problem
by fisher (Priest) on Nov 18, 2010 at 15:43 UTC
    add case-insensitive option.
    s/tbgl_([^ \t(_]+)/$1_gl/gi;
    and again, perldoc perlretut
      thank you fisher, your regex corrected some words but failed with wich JavaFan regex succeeded, this is my fault to not specify complete description; one of the reasons is that i can't post htm files, so if there is no harm to post a link to the file, i appreciate your patience [http://rapidshare.com/files/431638977/TBGL_SetMaterialDiffuse.htm]

        one of the reasons is that i can't post htm files

        You can post HTML code just like you can post Perl code. If you need to post so much code that you need an external service, *you* are doing a bad job asking your question. It's got nothing to do with what PerlMonks allows.

        (I'm not saying you did or didn't do a bad job asking your question; I'm just saying that you are mistaken in believing that posting huge HTML files would help.)

        No, thank you.