<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Regular expression query !!should be a good one in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549565#M724876</link>
    <description>If anyone is still reading this post.&lt;BR /&gt;Can someone tell me what you are talking about?&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;&lt;BR /&gt;Richard</description>
    <pubDate>Fri, 06 Jul 2001 20:30:40 GMT</pubDate>
    <dc:creator>someone_4</dc:creator>
    <dc:date>2001-07-06T20:30:40Z</dc:date>
    <item>
      <title>Regular expression query !!should be a good one</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549556#M724867</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have a definition in my file&lt;BR /&gt;&lt;BR /&gt;int func(/* sdsd*/int a, /*deep*/char b);&lt;BR /&gt;&lt;BR /&gt;I need to change it to &lt;BR /&gt;int func(              int a,                char b);&lt;BR /&gt;or &lt;BR /&gt;int func(int a,char b);&lt;BR /&gt;&lt;BR /&gt;Basically, I need to get rid of the comments in the line.&lt;BR /&gt;&lt;BR /&gt;Is there a regular expression substitution for this.&lt;BR /&gt;Also Note in "vi" I tried:&lt;BR /&gt;:%s/\/\*.*\*\///g&lt;BR /&gt;&lt;BR /&gt;I tired may other patterns with "(" and ")" stuff, but somehow did not work.&lt;BR /&gt;&lt;BR /&gt;Got any idea, please let me know.&lt;BR /&gt;&lt;BR /&gt;Thanks and Regards&lt;BR /&gt;Deepak&lt;BR /&gt;</description>
      <pubDate>Fri, 06 Jul 2001 09:47:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549556#M724867</guid>
      <dc:creator>Deepak_5</dc:creator>
      <dc:date>2001-07-06T09:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: Regular expression query !!should be a good one</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549557#M724868</link>
      <description>Deepaq,&lt;BR /&gt;&lt;BR /&gt;you just provided one DOT. So only any comment consisting of a single char will be replaced.&lt;BR /&gt;&lt;BR /&gt;I am not so deep in regexps, but I would try&lt;BR /&gt;&lt;BR /&gt;%s/\/\*.\*\///g&lt;BR /&gt;%s/\/\*..\*\///g&lt;BR /&gt;%s/\/\*...\*\///g&lt;BR /&gt;and so on (yes, not very sophisticated)...&lt;BR /&gt;&lt;BR /&gt;Volker</description>
      <pubDate>Fri, 06 Jul 2001 09:59:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549557#M724868</guid>
      <dc:creator>Volker Borowski</dc:creator>
      <dc:date>2001-07-06T09:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: Regular expression query !!should be a good one</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549558#M724869</link>
      <description>%s/\/\*[^\*]*\*\///g&lt;BR /&gt;&lt;BR /&gt;should do it.&lt;BR /&gt;&lt;BR /&gt;Robin</description>
      <pubDate>Fri, 06 Jul 2001 10:12:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549558#M724869</guid>
      <dc:creator>Robin Wakefield</dc:creator>
      <dc:date>2001-07-06T10:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: Regular expression query !!should be a good one</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549559#M724870</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;:%s;/\*[^\*]*\*/;;g&lt;BR /&gt;or&lt;BR /&gt;:%g;func;s;/\*[^\*]*\*/;;g   (for only the lines containing "func")&lt;BR /&gt;&lt;BR /&gt;should work too; by replacing the seperator by ";" you don't need to escape the "/" in your search.&lt;BR /&gt;&lt;BR /&gt;BTW: s;/\*.*\*/;...  will replace everyting between the first "/*" and the last "*/" on a line !!&lt;BR /&gt;&lt;BR /&gt;regards,&lt;BR /&gt;Thierry.</description>
      <pubDate>Fri, 06 Jul 2001 10:34:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549559#M724870</guid>
      <dc:creator>Thierry Poels_1</dc:creator>
      <dc:date>2001-07-06T10:34:44Z</dc:date>
    </item>
    <item>
      <title>Re: Regular expression query !!should be a good one</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549560#M724871</link>
      <description>Hi ,&lt;BR /&gt;&lt;BR /&gt;The seems to be some problem, my commets cannot have '*' or '/'&lt;BR /&gt;e.g.&lt;BR /&gt;int func1( /* *sdf */ int *a ,/*  */int b);&lt;BR /&gt;This is a valid C statement.&lt;BR /&gt;&lt;BR /&gt;Can Anyone handle this as well ?&lt;BR /&gt;&lt;BR /&gt;Thanks and Regards&lt;BR /&gt;Deepak&lt;BR /&gt;</description>
      <pubDate>Fri, 06 Jul 2001 12:00:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549560#M724871</guid>
      <dc:creator>Deepak_5</dc:creator>
      <dc:date>2001-07-06T12:00:00Z</dc:date>
    </item>
    <item>
      <title>Re: Regular expression query !!should be a good one</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549561#M724872</link>
      <description>hmmz,&lt;BR /&gt;:%s;/\*[^/]*\*/;;g&lt;BR /&gt;will allow "*" in your comments, but no "/" :)&lt;BR /&gt;So if you run both substitutes, everything should be OK.&lt;BR /&gt;&lt;BR /&gt;:%s;/\*[a-bA-Z0-9*/.:\; ]*\*/;;g&lt;BR /&gt;will do the trick in one step, add any character you need between the square brackets.&lt;BR /&gt;&lt;BR /&gt;good luck,&lt;BR /&gt;Thierry.</description>
      <pubDate>Fri, 06 Jul 2001 12:24:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549561#M724872</guid>
      <dc:creator>Thierry Poels_1</dc:creator>
      <dc:date>2001-07-06T12:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: Regular expression query !!should be a good one</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549562#M724873</link>
      <description>Thanks Theiry,but&lt;BR /&gt;:%s;/\*[a-bA-Z0-9*/.:\; ]*\*/;;g &lt;BR /&gt;&lt;BR /&gt;did not work fine for me . &lt;BR /&gt;e.g. int func1( /* sdf    /  *ddd  */ int *a ,int b);&lt;BR /&gt;is the input.&lt;BR /&gt;&lt;BR /&gt;There has to be way..&lt;BR /&gt;&lt;BR /&gt;Thanks and Regards&lt;BR /&gt;Deepak&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 06 Jul 2001 13:00:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549562#M724873</guid>
      <dc:creator>Deepak_5</dc:creator>
      <dc:date>2001-07-06T13:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: Regular expression query !!should be a good one</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549563#M724874</link>
      <description>Most regular expressions are greedy (matching as much as possible). Perl5 has an option to a reg expr to match a minimum. So try the following-&lt;BR /&gt;&lt;BR /&gt;perl -p -i -e 's{/\*.*?\*/}{}' yourprog.c&lt;BR /&gt;&lt;BR /&gt;The .*? will only match until the FIRST */ is found.</description>
      <pubDate>Fri, 06 Jul 2001 13:32:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549563#M724874</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2001-07-06T13:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: Regular expression query !!should be a good one</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549564#M724875</link>
      <description>Deepak:&lt;BR /&gt;&lt;BR /&gt;try this with sed(1):&lt;BR /&gt;&lt;BR /&gt;/func/ s#\(^.*\)\(\/\*..*\*\/\)\(.*\)\(\/\*..*\*\/\)\(.*$\)#\1 \3 \5#g&lt;BR /&gt;&lt;BR /&gt;\(^.*\)         starts matching the front&lt;BR /&gt;                of input lines&lt;BR /&gt;\(\/\*..*\*\/\) matches the comment you&lt;BR /&gt;                want to discard (at least&lt;BR /&gt;                one character e.g. "/* */")&lt;BR /&gt;\(.*\)          captures the text between&lt;BR /&gt;                comments&lt;BR /&gt;\(\/\*..*\*\/\) matches the second comment&lt;BR /&gt;                WARNING: _requires_ second cmnt&lt;BR /&gt;\(.*$\)         captures text up to the end&lt;BR /&gt;                of the line&lt;BR /&gt;&lt;BR /&gt;\1 \3 \5        recalls what was matched by&lt;BR /&gt;                those parenthetical statements&lt;BR /&gt;                numbered starting with 1 from&lt;BR /&gt;                left to right&lt;BR /&gt;&lt;BR /&gt;Again, this statement will "hit" only on lines&lt;BR /&gt;that have two embedded comments.&lt;BR /&gt;&lt;BR /&gt;Enjoy,&lt;BR /&gt;-dlt-&lt;BR /&gt;</description>
      <pubDate>Fri, 06 Jul 2001 17:38:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549564#M724875</guid>
      <dc:creator>David Totsch</dc:creator>
      <dc:date>2001-07-06T17:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: Regular expression query !!should be a good one</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549565#M724876</link>
      <description>If anyone is still reading this post.&lt;BR /&gt;Can someone tell me what you are talking about?&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;&lt;BR /&gt;Richard</description>
      <pubDate>Fri, 06 Jul 2001 20:30:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549565#M724876</guid>
      <dc:creator>someone_4</dc:creator>
      <dc:date>2001-07-06T20:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: Regular expression query !!should be a good one</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549566#M724877</link>
      <description>Richard,&lt;BR /&gt;&lt;BR /&gt;We still are very much there to get a perfect solution.&lt;BR /&gt;&lt;BR /&gt;The input is this line&lt;BR /&gt;int func1(  /* sdf * */ int *a ,/* /  */ int b/* wewe */); &lt;BR /&gt;&lt;BR /&gt;Reduce it to.&lt;BR /&gt;int func1(  int *a ,int b); &lt;BR /&gt;&lt;BR /&gt;Note:&lt;BR /&gt;The may be any number of comments in a line , and any valid&lt;BR /&gt;character in those comments.&lt;BR /&gt;&lt;BR /&gt;Thanks for the all the responses. &lt;BR /&gt;With response, we have got till now, there seems&lt;BR /&gt;to be no way through pure regular expression,&lt;BR /&gt;except for the perl stuff(Cannot use perl though).&lt;BR /&gt;Can be awk/sed.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks and Regards&lt;BR /&gt;Deepak&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Sat, 07 Jul 2001 05:08:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/regular-expression-query-should-be-a-good-one/m-p/2549566#M724877</guid>
      <dc:creator>Deepak_5</dc:creator>
      <dc:date>2001-07-07T05:08:42Z</dc:date>
    </item>
  </channel>
</rss>

