• 0

Regular Expression Help!


Question

I'm not good at regular expressions so I was hoping someone here can point me to what is wrong with my expression....

I'm trying to remove the code in between "method ChangeCurrentUserId" and "end-method". I am using the following expression

(^method .*)([^*]*)(^end-method;)

replace expression

$1$3

The expression fails when it encounters '/* xxx */' - if I change the '*' to say a + the expression works. .... anyone with ideas?

Thanks

/** 
 * ChangeCurrentUserId
 *
 *
 * @param &newUserId  to switch to.
 * @return if the switch was successful.
 */
method ChangeCurrentUserId
   /+ &newUserId as String +/
   /+ Returns Boolean +/


   If %UserId = &newUserId Then
	  Return True;
   End-If;

   /* xxx */

   If &count <> 2 Then
	  Return False;
   Else
	  ....
	  Return ((%UserId = &newUserId) And
		 (&switchOk));
   End-If;
end-method;

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

take the sample input above and show me what you expect the sample output to be.

as a side note '^' can mean different things. if it's inside of a character class like so: "[^*]" then it means any character that is not a star. if it's not in a character class but at the beginning of a pattern like so: "^house" then it means the pattern has to start with the word house. so "house party" and "house color" match, but "my house" does not match.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.