file renaming from xxyyyyyyyname to xxyyyyyyy - name

hi, i have several images that are named as a 2letterfollowed by 7 numbers then a descriptive name, i would like to rename them so the id and descriptive name are separated by a " - " example

from an1234567assetimage to an1234567 - assetimage.

if possible id like to integrate this with a current script that iv made so ideally would like to use php if possible if not maybe c#. any advice?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

In php
$Filename =~ m/^([a-z]+)(\d+)(.*)$/I;
$1 will have the two first letters
$2 will have the numeric portion
$3 will have all that is left.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
$match is the array reference to the three elements.
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

nwalker78Author Commented:
Ray PaseurCommented:
Putting the dash into a file name can cause some "interesting" effects if you use the name (even untentionally) in JavaScript.  Putting blanks around the dash can cause some other "interesting" effects that may require special syntax for all references to the files, such as encapsulating or putting quotes around the names.

A common workaround that allows visual and programmatic separation without these side-effects would be to put a single underscore into the file name, like this:

from an1234567assetimage to an1234567_assetimage.

The regular expression to isolate the parts will remain the same - it's just a minor difference in reassembling the parts.
Don't do that in PHP, Since you are speaking of C# I assume your PHP run on Windows.
PHP doesn't support UTF16 NTFS name properly, and will only work within the 8 bit code page.
It will work on Linux when using UTF-8 file name,
But file management and renaming on windows will be a disaster.
I would recommend you do that in Powershell something along those line :
Get-ChildItem "C:\folder" | Where-Object {$_.Name -match "^([a-z]+)(\d{7})(.*)$"} | Rename-Item -NewName { $_.Name -replace "^([a-z]+\d{7})(.*)$" , "$1 - $2" }

I didn't test it...
Presumably this data is also in a DB, and needs to be updated simultaneously?
nwalker78Author Commented:
Hi yes adatabase is involved and in the main the updating of it has been taken careof.  Its just that when i changed the naming convention about 3000 images didnt get renamed properly and goin through them one by one got abit tedious lol.

Im not familiar with powershell is that built into windows7?  

Thanks for the help
nwalker78Author Commented:
appologies for the delay been in hospital. and forgot question was still open.
NO prob on delay.  hope all is well.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.