Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7751851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:39:12+00:00 2026-06-01T11:39:12+00:00

This is something for regexp lovers :) FLOW3’s Code Convention claim that you should

  • 0

This is something for regexp lovers 🙂

FLOW3’s Code Convention claim that you should annotate methods that do not return anything with @return void:

/**
 * A method
 *
 * @return void
 */

I keep forgetting it and want to regexp with netbeans for all methods that I’ve missed …

So far i got

\*\s[^@return]+.*(\n)\s.\*/ 

Which does not work really well:

/**
 * Method that gets matched.
 *
 * @param string $comment
 */
public function aMethod() {
    // Some Code
}

/**
 * A method that does not get matched and shouldn't.
 *
 * @param string $test
 * @return void
 */
public function anotherMethod($test) {
    // Some Code
}


/**
 * A variable that get's matched but should not
     * be matched.
 *
 * @var string
 */
protected $var;

/**
 * Why is this method getting matched?
 *
 * @return void
 */
private function thirdMethod() {
        // Code
    }

How would you match this?

Here’s an example in a regexp tester:

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T11:39:14+00:00Added an answer on June 1, 2026 at 11:39 am

    A negative lookbehind assertion might help:

    \*\s*@[a-z]+(?<!return)\s+.+\s*\*/\s*(?:public|protected|private)?\s+function
    

    This will match any function which does not have @return as the last line of the docblock. It might have some false positives, i.e. where a @return is there but not on the last line, but it’s a good start.

    Note that this doesn’t work in Regex tester because JavaScript doesn’t support the lookbehind assertion. Here’s an example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm guessing this is going to involve regexp or something, but I'll give it
How can a validation exclude a regexp? I'm looking for something like this: validates_format_of
I've been whacking on this regex for a while, trying to build something that
I need a regexp to match something like this, 'text' | 'text' | ...
I searched but couldnt find something like this regexp. This regexp has to catch
String ex. something.text = obj.something I am looking for a REGEXP that will swap
I'm using excel 2007 and i'm adding a macro that looks something like this
I have a txt file that looks something like this ----------------------------------- RUNNING PROCESSES -----------------------------------
While playing around with regexps in Scala I wrote something like this: scala> val
I have a value like this: Foo Bar Another Value something else What regex

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.