<p>I need a Regex that will match a java method declaration. I have come up with one that will match a method declaration, but it requires the opening bracket of the method to be on the same line as the declaration. If you have any suggestions to improve my regex or simply have a better one then please submit an answer.</p>

<p>Here is my regex: <code>"\w+ +\w+ *\(.*\) *\{"</code></p>

<p>For those who do not know what a java method looks like I'll provide a basic one:</p>

<pre><code>int foo()
{

}
</code></pre>

<p>There are several optional parts to java methods that may be added as well but those are the only parts that a method is guaranteed to have.</p>

<p>Update:
My current Regex is <code>"\w+ +\w+ *\([^\)]*\) *\{"</code> so as to prevent the situation that Mike and adkom described.</p>

[{'answer_id': 68669, 'author': 'Mike Stone', 'author_id': 122, 'author_profile': 'https://Stackoverflow.com/users/122', 'pm_score': 3, 'selected': True, 'text': '<p>Have you considered matching the actual possible keywords?  such as:</p>\n\n<pre><code>(?:(?:public)|(?:private)|(?:static)|(?:protected)\\s+)*\n</code></pre>\n\n<p>It might be a bit more likely to match correctly, though it might also make the regex harder to read...</p>\n'}, {'answer_id': 68697, 'author': 'akdom', 'author_id': 145, 'author_profile': 'https://Stackoverflow.com/users/145', 'pm_score': 2, 'selected': False, 'text': '<p>I\'m pretty sure Java\'s regex engine is greedy by default, meaning that <code>"\\w+ +\\w+ *\\(.*\\) *\\{"</code> will never match since the <code>.*</code> within the parenthesis will eat everything after the opening paren.  I recommend you replace the <code>.*</code> with [^)], this way you it will select all non-closing-paren characters.</p>\n\n<p><strong>NOTE:</strong>  Mike Stone corrected me in the comments, and since most people don\'t really open the comments (I know I frequently don\'t notice them):</p>\n\n<blockquote>\n  <p>Greedy doesn\'t mean it will never match... but it will eat parens if there are more parens after to satisfy the rest of the regex... so for example "public void foo(int arg) { if (test) { System.exit(0); } }" will not match properly... </p>\n</blockquote>\n'}, {'answer_id': 68890, 'author': 'UnkwnTech', 'author_id': 115, 'author_profile': 'https://Stackoverflow.com/users/115', 'pm_score': 2, 'selected': False, 'text': "<p>I came up with this:<br /></p>\n\n<pre><code>\\b\\w*\\s*\\w*\\(.*?\\)\\s*\\{[\\x21-\\x7E\\s]*\\}\n</code></pre>\n\n<p>I tested it against a PHP function but it should work just the same, this is the snippet of code I used:\n<br/></p>\n\n<pre><code>function getProfilePic($url)\n {\n    if(@open_image($url) !== FALSE)\n     {\n        @imagepng($image, 'images/profiles/' . $_SESSION['id'] . '.png');\n        @imagedestroy($image);\n        return TRUE;\n     }\n    else \n     {\n        return FALSE;\n     }\n }\n</code></pre>\n\n<p>MORE INFO:<br /></p>\n\n<pre><code>Options: case insensitive\n\nAssert position at a word boundary «\\b»\nMatch a single character that is a “word character” (letters, digits, etc.) «\\w*»\n   Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»\nMatch a single character that is a “whitespace character” (spaces, tabs, line breaks, etc.) «\\s*»\n   Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»\nMatch a single character that is a “word character” (letters, digits, etc.) «\\w*»\n   Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»\nMatch the character “(” literally «\\(»\nMatch any single character that is not a line break character «.*?»\n   Between zero and unlimited times, as few times as possible, expanding as needed (lazy) «*?»\nMatch the character “)” literally «\\)»\nMatch a single character that is a “whitespace character” (spaces, tabs, line breaks, etc.) «\\s*»\n   Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»\nMatch the character “{” literally «\\{»\nMatch a single character present in the list below «[\\x21-\\x7E\\s]*»\n   Between zero and unlimited times, as many times as possible, giving back as needed (greedy) «*»\n   A character in the range between ASCII character 0x21 (33 decimal) and ASCII character 0x7E (126 decimal) «\\x21-\\x7E»\n   A whitespace character (spaces, tabs, line breaks, etc.) «\\s»\nMatch the character “}” literally «\\}»\n\n\nCreated with RegexBuddy\n</code></pre>\n"}, {'answer_id': 69604, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 1, 'selected': False, 'text': '<p>A tip:</p>\n\n<p>If you are going to write the regex in Perl, please use the "xms" options so that you can leave spaces and document the regex. For example you can write a regex like:</p>\n\n<pre><code> m{\\w+ \\s+      #return type\n   \\w+ \\s*      #function name\n   [(] [^)]* [)] #params\n   \\s* [{]           #open paren\n  }xms\n</code></pre>\n\n<p>One of the options (think x) allows the # comments inside a regex. Also use \\s instead of a " ". \\s stands for any "blank" character. So tabs would also match -- which is what you would want. In Perl you don\'t need to use / /, you can use { } or &lt; > or | |.</p>\n\n<p>Not sure if other languages have this ability. If they do, then please use them.</p>\n'}, {'answer_id': 847507, 'author': 'Georgios Gousios', 'author_id': 51681, 'author_profile': 'https://Stackoverflow.com/users/51681', 'pm_score': 5, 'selected': False, 'text': '<pre><code>(public|protected|private|static|\\s) +[\\w\\&lt;\\&gt;\\[\\]]+\\s+(\\w+) *\\([^\\)]*\\) *(\\{?|[^;])\n</code></pre>\n\n<p>I think that the above regexp can match almost all possible combinations of Java method declarations, even those including generics and arrays are return arguments, which the regexp provided by the original author did not match.</p>\n'}, {'answer_id': 11672271, 'author': 'idbrii', 'author_id': 79125, 'author_profile': 'https://Stackoverflow.com/users/79125', 'pm_score': 0, 'selected': False, 'text': '<p>I built a vim regex to do this for <a href="https://github.com/pydave/ctrlp-funky/blob/master/autoload/ctrlp/funky/java.vim" rel="nofollow">ctrlp/funky</a> based on Georgios Gousios\'s answer.</p>\n\n<pre><code>    let regex = \'\\v^\\s+\'                " preamble\n    let regex .= \'%(&lt;\\w+&gt;\\s+){0,3}\'     " visibility, static, final\n    let regex .= \'%(\\w|[&lt;&gt;[\\]])+\\s+\'    " return type\n    let regex .= \'\\w+\\s*\'               " method name\n    let regex .= \'\\([^\\)]*\\)\'           " method parameters\n    let regex .= \'%(\\w|\\s|\\{)+$\'        " postamble\n</code></pre>\n\n<p>I\'d guess that looks like this in Java:</p>\n\n<pre><code>^\\s+(?:&lt;\\w+&gt;\\s+){0,3}(?:[\\w\\&lt;\\&gt;\\[\\]])+\\s+\\w+\\s*\\([^\\)]*\\)(?:\\w|\\s|\\{)+$\n</code></pre>\n'}, {'answer_id': 16118844, 'author': 'sbaltes', 'author_id': 1974143, 'author_profile': 'https://Stackoverflow.com/users/1974143', 'pm_score': 3, 'selected': False, 'text': '<p>I also needed such a regular expression and came up with this solution:</p>\n\n<pre><code>(?:(?:public|private|protected|static|final|native|synchronized|abstract|transient)+\\s+)+[$_\\w&lt;&gt;\\[\\]\\s]*\\s+[\\$_\\w]+\\([^\\)]*\\)?\\s*\\{?[^\\}]*\\}?\n</code></pre>\n\n<p>This <a href="http://cui.unige.ch/isi/bnf/JAVA/BNFindex.html" rel="nofollow noreferrer">grammar</a> and Georgios Gousios answer have been useful to build the regex.</p>\n\n<p><strong>EDIT:</strong> Considered tharindu_DG\'s feedback, made groups non-capturing, improved formatting.</p>\n'}, {'answer_id': 19030300, 'author': 'aliteralmind', 'author_id': 2736496, 'author_profile': 'https://Stackoverflow.com/users/2736496', 'pm_score': 3, 'selected': False, 'text': '<p>After looking through the other answers, here is what I came up with:</p>\n\n<pre><code>#permission\n   ^[ \\t]*(?:(?:public|protected|private)\\s+)?\n#keywords\n   (?:(static|final|native|synchronized|abstract|threadsafe|transient|{#insert zJRgx123GenericsNotInGroup})\\s+){0,}\n#return type\n   #If return type is "return" then it\'s actually a \'return funcName();\' line. Ignore.\n   (?!return)\n   \\b([\\w.]+)\\b(?:|{#insert zJRgx123GenericsNotInGroup})((?:\\[\\]){0,})\\s+\n#function name\n   \\b\\w+\\b\\s*\n#parameters\n   \\(\n      #one\n         \\s*(?:\\b([\\w.]+)\\b(?:|{#insert zJRgx123GenericsNotInGroup})((?:\\[\\]){0,})(\\.\\.\\.)?\\s+(\\w+)\\b(?![&gt;\\[])\n      #two and up\n         \\(\\s*(?:,\\s+\\b([\\w.]+)\\b(?:|{#insert zJRgx123GenericsNotInGroup})((?:\\[\\]){0,})(\\.\\.\\.)?\\s+(\\w+)\\b(?![&gt;\\[])\\s*){0,})?\\s*\n   \\)\n#post parameters\n   (?:\\s*throws [\\w.]+(\\s*,\\s*[\\w.]+))?\n#close-curly (concrete) or semi-colon (abstract)\n   \\s*(?:\\{|;)[ \\t]*$\n</code></pre>\n\n<hr>\n\n<p>Where <code>{#insert zJRgx123GenericsNotInGroup}</code> equals</p>\n\n<pre><code>`(?:&lt;[?\\w\\[\\] ,.&amp;]+&gt;)|(?:&lt;[^&lt;]*&lt;[?\\w\\[\\] ,.&amp;]+&gt;[^&gt;]*&gt;)|(?:&lt;[^&lt;]*&lt;[^&lt;]*&lt;[?\\w\\[\\] ,.&amp;]+&gt;[^&gt;]*&gt;[^&gt;]*&gt;)`\n</code></pre>\n\n<p>Limitations:</p>\n\n<ul>\n<li>ANY parameter can have an ellipsis: "..." (Java allows only last)</li>\n<li>Three levels of nested generics at most: (<code>&lt;...&lt;...&lt;...&gt;...&gt;...&gt;</code> okay, <code>&lt;...&lt;...&lt;...&lt;...&gt;...&gt;...&gt;...&gt;</code> bad). The syntax inside generics can be very bogus, and still seem okay to this regex.</li>\n<li>Requires no spaces between types and their (optional) opening generics \'&lt;\'</li>\n<li>Recognizes inner classes, but doesn\'t prevent two dots next to each other, such as Class....InnerClass</li>\n</ul>\n\n<p>Below is the raw PhraseExpress code (auto-text and description on line 1, body on line 2). Call <code>{#insert zJRgxJavaFuncSigThrSemicOrOpnCrly}</code>, and you get this:</p>\n\n<pre><code>^[ \\t]*(?:(?:public|protected|private)\\s+)?(?:(static|final|native|synchronized|abstract|threadsafe|transient|(?:&lt;[?\\w\\[\\] ,&amp;]+&gt;)|(?:&lt;[^&lt;]*&lt;[?\\w\\[\\] ,&amp;]+&gt;[^&gt;]*&gt;)|(?:&lt;[^&lt;]*&lt;[^&lt;]*&lt;[?\\w\\[\\] ,&amp;]+&gt;[^&gt;]*&gt;[^&gt;]*&gt;))\\s+){0,}(?!return)\\b([\\w.]+)\\b(?:|(?:&lt;[?\\w\\[\\] ,&amp;]+&gt;)|(?:&lt;[^&lt;]*&lt;[?\\w\\[\\] ,&amp;]+&gt;[^&gt;]*&gt;)|(?:&lt;[^&lt;]*&lt;[^&lt;]*&lt;[?\\w\\[\\] ,&amp;]+&gt;[^&gt;]*&gt;[^&gt;]*&gt;))((?:\\[\\]){0,})\\s+\\b\\w+\\b\\s*\\(\\s*(?:\\b([\\w.]+)\\b(?:|(?:&lt;[?\\w\\[\\] ,&amp;]+&gt;)|(?:&lt;[^&lt;]*&lt;[?\\w\\[\\] ,&amp;]+&gt;[^&gt;]*&gt;)|(?:&lt;[^&lt;]*&lt;[^&lt;]*&lt;[?\\w\\[\\] ,&amp;]+&gt;[^&gt;]*&gt;[^&gt;]*&gt;))((?:\\[\\]){0,})(\\.\\.\\.)?\\s+(\\w+)\\b(?![&gt;\\[])\\s*(?:,\\s+\\b([\\w.]+)\\b(?:|(?:&lt;[?\\w\\[\\] ,&amp;]+&gt;)|(?:&lt;[^&lt;]*&lt;[?\\w\\[\\] ,&amp;]+&gt;[^&gt;]*&gt;)|(?:&lt;[^&lt;]*&lt;[^&lt;]*&lt;[?\\w\\[\\] ,&amp;]+&gt;[^&gt;]*&gt;[^&gt;]*&gt;))((?:\\[\\]){0,})(\\.\\.\\.)?\\s+(\\w+)\\b(?![&gt;\\[])\\s*){0,})?\\s*\\)(?:\\s*throws [\\w.]+(\\s*,\\s*[\\w.]+))?\\s*(?:\\{|;)[ \\t]*$\n</code></pre>\n\n<hr>\n\n<p>Raw code:</p>\n\n<pre><code>zJRgx123GenericsNotInGroup -- To precede return-type    (?:&lt;[?\\w\\[\\] ,.&amp;]+&gt;)|(?:&lt;[^&lt;]*&lt;[?\\w\\[\\] ,.&amp;]+&gt;[^&gt;]*&gt;)|(?:&lt;[^&lt;]*&lt;[^&lt;]*&lt;[?\\w\\[\\] ,.&amp;]+&gt;[^&gt;]*&gt;[^&gt;]*&gt;)  zJRgx123GenericsNotInGroup\nzJRgx0OrMoreParams  \\s*(?:{#insert zJRgxParamTypeName}\\s*(?:,\\s+{#insert zJRgxParamTypeName}\\s*){0,})?\\s*   zJRgx0OrMoreParams\nzJRgxJavaFuncNmThrClsPrn_M_fnm -- Needs zvFOBJ_NAME (?&lt;=\\s)\\b{#insert zvFOBJ_NAME}{#insert zzJRgxPostFuncNmThrClsPrn}   zJRgxJavaFuncNmThrClsPrn_M_fnm\nzJRgxJavaFuncSigThrSemicOrOpnCrly -(**)-    {#insert zzJRgxJavaFuncSigPreFuncName}\\w+{#insert zzJRgxJavaFuncSigPostFuncName}    zJRgxJavaFuncSigThrSemicOrOpnCrly\nzJRgxJavaFuncSigThrSemicOrOpnCrly_M_fnm -- Needs zvFOBJ_NAME    {#insert zzJRgxJavaFuncSigPreFuncName}{#insert zvFOBJ_NAME}{#insert zzJRgxJavaFuncSigPostFuncName}  zJRgxJavaFuncSigThrSemicOrOpnCrly_M_fnm\nzJRgxOptKeywordsBtwScopeAndRetType  (?:(static|final|native|synchronized|abstract|threadsafe|transient|{#insert zJRgx123GenericsNotInGroup})\\s+){0,}    zJRgxOptKeywordsBtwScopeAndRetType\nzJRgxOptionalPubProtPriv    (?:(?:public|protected|private)\\s+)?    zJRgxOptionalPubProtPriv\nzJRgxParamTypeName -(**)- Ends w/ \'\\b(?![&gt;\\[])\' to NOT find &lt;? \'extends XClass\'&gt; or ...[]&gt;  (*Original: zJRgxParamTypeName, Needed by: zJRgxParamTypeName[4FQPTV,ForDel[NmsOnly,Types]]*){#insert zJRgxTypeW0123GenericsArry}(\\.\\.\\.)?\\s+(\\w+)\\b(?![&gt;\\[])   zJRgxParamTypeName\nzJRgxTypeW0123GenericsArry -- Grp1=Type, Grp2=\'[]\', if any  \\b([\\w.]+)\\b(?:|{#insert zJRgx123GenericsNotInGroup})((?:\\[\\]){0,}) zJRgxTypeW0123GenericsArry\nzvTTL_PRMS_stL1c    {#insert zCutL1c}{#SETPHRASE -description zvTTL_PRMS -content {#INSERTCLIPBOARD} -autotext zvTTL_PRMS -folder ctvv_folder}  zvTTL_PRMS_stL1c\nzvTTL_PRMS_stL1cSvRstrCB    {#insert zvCB_CONTENTS_stCB}{#insert zvTTL_PRMS_stL1c}{#insert zSetCBToCB_CONTENTS} zvTTL_PRMS_stL1cSvRstrCB\nzvTTL_PRMS_stPrompt {#SETPHRASE -description zvTTL_PRMS -content {#INPUT -head How many parameters? -single} -autotext zvTTL_PRMS -folder ctvv_folder}  zvTTL_PRMS_stPrompt\nzzJRgxJavaFuncNmThrClsPrn_M_fnmTtlp -- Needs zvFOBJ_NAME, zvTTL_PRMS    (?&lt;=[ \\t])\\b{#insert zvFOBJ_NAME}\\b\\s*\\(\\s*{#insert {#COND -if {#insert zvTTL_PRMS} = 0 -then z1slp -else zzParamsGT0_M_ttlp}}\\)    zzJRgxJavaFuncNmThrClsPrn_M_fnmTtlp\nzzJRgxJavaFuncSigPostFuncName   {#insert zzJRgxPostFuncNmThrClsPrn}(?:\\s*throws \\b(?:[\\w.]+)\\b(\\s*,\\s*\\b(?:[\\w.]+)\\b))?\\s*(?:\\{|;)[ \\t]*$   zzJRgxJavaFuncSigPostFuncName\nzzJRgxJavaFuncSigPreFuncName    (*If a type has generics, there may be no spaces between it and the first open \'&lt;\', also requires generics with three nestings at the most (&lt;...&lt;...&lt;...&gt;...&gt;...&gt; okay, &lt;...&lt;...&lt;...&lt;...&gt;...&gt;...&gt;...&gt; not)*)^[ \\t]*{#insert zJRgxOptionalPubProtPriv}{#insert zJRgxOptKeywordsBtwScopeAndRetType}(*To prevent \'return funcName();\' from being recognized:*)(?!return){#insert zJRgxTypeW0123GenericsArry}\\s+\\b  zzJRgxJavaFuncSigPreFuncName\nzzJRgxPostFuncNmThrClsPrn   \\b\\s*\\({#insert zJRgx0OrMoreParams}\\)   zzJRgxPostFuncNmThrClsPrn\nzzParamsGT0_M_ttlp -- Needs zvTTL_PRMS  {#insert zJRgxParamTypeName}\\s*{#insert {#COND -if {#insert zvTTL_PRMS} = 1 -then z1slp -else zzParamsGT1_M_ttlp}}  zzParamsGT0_M_ttlp\nzzParamsGT1_M_ttlp  {#LOOP ,\\s+{#insert zJRgxParamTypeName}\\s* -count {#CALC {#insert zvTTL_PRMS} - 1 -round 0 -thousands none}}    zzParamsGT1_M_ttlp\n</code></pre>\n'}, {'answer_id': 21172210, 'author': 'Dexygen', 'author_id': 34806, 'author_profile': 'https://Stackoverflow.com/users/34806', 'pm_score': 1, 'selected': False, 'text': '<p>This is for a more specific use case but it\'s so much simpler I believe its worth sharing.  I did this for finding \'public static void\' methods i.e. Play controller actions, and I did it from the Windows/Cygwin command line, using grep; see: <a href="https://stackoverflow.com/a/7167115/34806">https://stackoverflow.com/a/7167115/34806</a></p>\n\n<pre><code>cat Foobar.java | grep -Pzo \'(?s)public static void.*?\\)\\s+{\'\n</code></pre>\n\n<p>The last two entries from my output are as follows:</p>\n\n<pre><code>public static void activeWorkEventStations (String type,\n            String symbol,\n            String section,\n            String day,\n            String priority,\n            @As("yyyy-MM-dd") Date scheduleDepartureDate) {\npublic static void getActiveScheduleChangeLogs(String type,\n            String symbol,\n            String section,\n            String day,\n            String priority,\n            @As("yyyy-MM-dd") Date scheduleDepartureDate) {\n</code></pre>\n'}, {'answer_id': 36217245, 'author': 'tharindu_DG', 'author_id': 1894198, 'author_profile': 'https://Stackoverflow.com/users/1894198', 'pm_score': 0, 'selected': False, 'text': "<p>I found <strong>seba229</strong>'s answer useful, it captures most of the scenarios, but not the following,</p>\n\n<pre><code>public &lt;T&gt; T name(final Class&lt;T&gt; x, final T y)\n</code></pre>\n\n<p>This regex will capture that also.</p>\n\n<pre><code>((public|private|protected|static|final|native|synchronized|abstract|transient)+\\s)+[\\$_\\w\\&lt;\\&gt;\\w\\s\\[\\]]*\\s+[\\$_\\w]+\\([^\\)]*\\)?\\s*\n</code></pre>\n\n<p>Hope this helps.</p>\n"}, {'answer_id': 45900932, 'author': 'user1122069', 'author_id': 1122069, 'author_profile': 'https://Stackoverflow.com/users/1122069', 'pm_score': 0, 'selected': False, 'text': '<pre><code>(public|private|static|protected) ([A-Za-z0-9&lt;&gt;.]+) ([A-Za-z0-9]+)\\(\n</code></pre>\n\n<p>Also, here\'s a replace sequence you can use in IntelliJ</p>\n\n<pre><code>$1 $2 $3(\n</code></pre>\n\n<p>I use it like this:</p>\n\n<pre><code>$1 $2 aaa$3(\n</code></pre>\n\n<p>when converting Java files to Kotlin to prevent functions that start with "get" from automatically turning into variables. Doesn\'t work with "default" access level, but I don\'t use that much myself.</p>\n'}, {'answer_id': 48072172, 'author': 'Souvik Das', 'author_id': 9166774, 'author_profile': 'https://Stackoverflow.com/users/9166774', 'pm_score': 2, 'selected': False, 'text': "<p><code>(public|private|static|protected|abstract|native|synchronized) +([a-zA-Z0-9&lt;&gt;._?, ]+) +([a-zA-Z0-9_]+) *\\\\([a-zA-Z0-9&lt;&gt;\\\\[\\\\]._?, \\n]*\\\\) *([a-zA-Z0-9_ ,\\n]*) *\\\\{</code></p>\n\n<p>The Regex above will detect all possible java method definitions. Tested on lot's of source code files. To include constructors as well use the below regex :</p>\n\n<p><code>(public|private|static|protected|abstract|native|synchronized) +([a-zA-Z0-9&lt;&gt;._?, ]*) +([a-zA-Z0-9_]+) *\\\\([a-zA-Z0-9&lt;&gt;\\\\[\\\\]._?, \\n]*\\\\) *([a-zA-Z0-9_ ,\\n]*) *\\\\{</code></p>\n"}, {'answer_id': 52996479, 'author': 'LarsH', 'author_id': 423105, 'author_profile': 'https://Stackoverflow.com/users/423105', 'pm_score': 1, 'selected': False, 'text': '<p>As of git 2.19.0, the <a href="https://git.kernel.org/pub/scm/git/git.git/tree/userdiff.c" rel="nofollow noreferrer">built-in regexp for Java</a> now seems to work well, so supplying your own may not be necessary.</p>\n\n<pre><code>"!^[ \\t]*(catch|do|for|if|instanceof|new|return|switch|throw|while)\\n"\n"^[ \\t]*(([A-Za-z_][A-Za-z_0-9]*[ \\t]+)+[A-Za-z_][A-Za-z_0-9]*[ \\t]*\\\\([^;]*)$"\n</code></pre>\n\n<p>(The first line seems to be for filtering out lines that resemble method declarations but aren\'t.)</p>\n'}, {'answer_id': 55051029, 'author': 'Abdullah Khan', 'author_id': 9758506, 'author_profile': 'https://Stackoverflow.com/users/9758506', 'pm_score': 1, 'selected': False, 'text': '<p>This will pick the name of method not the whole line.</p>\n\n<pre><code>(?&lt;=public static void )\\w+|(?&lt;=private static void )\\w+|(?&lt;=protected static void )\\w+|(?&lt;=public void )\\w+|(?&lt;=private void )\\w+|(?&lt;=protected void )\\w+|(?&lt;=public final void)\\w+|(?&lt;=private final void)\\w+|(?&lt;=protected final void)\\w+|(?&lt;=private void )\\w+|(?&lt;=protected void )\\w+|(?&lt;=public static final void )\\w+|(?&lt;=private static final void )\\w+|(?&lt;=public final static void )\\w+|(?&lt;=protected final static void )\\\\w+|(?&lt;=private final static void )\\w+|(?&lt;=protected final static void )\\w+|(?&lt;=void )\\w+|(?&lt;=private static )\\w+\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/68633', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/340/']