How to use regex in a google search button?

I have a button with this code

@runonce:@set googlename={dlgstringS|Enter the Searching string|{file$|noext}}

This button can open the default browser & search in with the selected file name.
now I want to search some part of the file name. so I want to use the regex with this button to match some part of the selected file name.

example. the selected file name is
I_am_34_years_old_not_43 years
I want to search in google
I have no Idea how to use the regex in this button.
but I have tried to find some regex code for select the part of the file name in rename dialog box

but here i cannot find the right code. as you can se my screenshot i use this code


but, this code match the 2nd digit set 43 also in my filename string. but I want to match the 1st digit set only, in this case 34 and want to remove everything after the first digit set.

Make .* non-greedy by adding a ?:

1 Like

Thanks lxp
But This is Half of my Solution.
Now how to use this regex in the google search button?

You'd need to use scripting for that.

1 Like

I have no ability to write a script, Please do it for me.

No sorry.

Thanks Jon
I had found a script in forum from Leo, But This Script take the selected files full name to the browser
But my need is Takes a part of the file name before the first 4 digit set. like
I_ in 1985 not 1988
Here some time the separator can be _ or - or . or space all I need to capture
I_ in 1985 to the browser
That mean 1985 is always a 4 digit number set.

function OnClick(data) {
  var objEnum = new Enumerator(data.func.sourcetab.selected);
  while (!objEnum.atEnd()) {
   var item = objEnum.item().name_stem; objEnum.moveNext();
   var encoded = encodeURIComponent(item);
   var search = encoded.replace(/%/g,"%%");
   data.func.command.RunCommand("" + search);

If any body can please edit this script