Find Jobs
Hire Freelancers

Solve specific PHP string expansion problem

$10-30 USD

Cancelled
Posted about 5 years ago

$10-30 USD

Paid on delivery
I have a string composed of letters and square brackets ONLY. The square brackets define groups of letters. One letter from each group can be chosen in each expansion. I need to expand these letters into its actual strings. From this: $str = 'ABCCDF[GH]IJJ[KLM]' To this: $sub[0] = 'ABCCDFGIJJK'; $sub[1] = 'ABCCDFHIJJK'; $sub[2] = 'ABCCDFGIJJL'; $sub[3] = 'ABCCDFHIJJL'; $sub[4] = 'ABCCDFGIJJM'; $sub[5] = 'ABCCDFHIJJM'; The solution should be in PHP, compatible with 7.2 Should use no external libraries, only core PHP I expect a function with a string as input and an array of strings as a return function (string $string) : array { } Should work with strings like the example but no limit in the number of groups or in the number of letters in each group. Should be a generic function. Could be a recursive function. The letters between brackets are groups, and you can choose only one (1) of these letter for each expansion. You should do the corresponding permutations Other valid examples the function should solve are: $str = 'AB[ST]DF[GH]IJJ[KLM]A' To this: $sub[0] = 'ABSDFGIJJKA'; $sub[1] = 'ABSDFHIJJKA'; $sub[2] = 'ABSDFGIJJLA'; $sub[3] = 'ABSDFHIJJLA'; $sub[4] = 'ABSDFGIJJMA'; $sub[5] = 'ABSDFHIJJMA'; $sub[6] = 'ABTDFGIJJKA'; $sub[7] = 'ABTDFHIJJKA'; $sub[8] = 'ABTDFGIJJLA'; $sub[9] = 'ABTDFHIJJLA'; $sub[10] = 'ABTDFGIJJMA'; $sub[11] = 'ABTDFHIJJMA'; For example: A[BC]D should be expanded in: ABD ACD Another example AA[DCF] should be expanded in: AAD AAC AAF Another example with many groups AF[RT]SD[ER]D should be expanded in: AFRSDED AFTSDED AFRSDRD AFTSDRD One las example [AB] Should be expanded in: A B Strings without brackets are returned as is: AABCDFGTY is expanded in AABCDFGTY Examples of illegal (never expected strings) YOU SHOULD NOT HANDLE THIS CASES BECAUSE I TAKE CARE OF INPUT VALIDATION, THIS INFO IS ONLY FOR CLARITY: [A[B]]CCDD -> never nested brackets AB[CCD]FGG -> never groups with a repeated letter ADFG$% HJ -> characters different from letters and square brackets NOTE: * The returned array elements order is not important * There should not be exception handling in the input side. I take care of that. The input string is only letters [A-Z] and symbols '[' and ']' * Groups could be at the very beginning and/or at the very end then '[AE]DDFFGV[FGH]' is a valid string to be parsed. * Letters inside one group will never be repeated, for example, AB[CCD]E is not valid input and you don't need to check this case because I handle it.
Project ID: 18635643

About the project

18 proposals
Remote project
Active 5 yrs ago

Looking to make some money?

Benefits of bidding on Freelancer

Set your budget and timeframe
Get paid for your work
Outline your proposal
It's free to sign up and bid on jobs
18 freelancers are bidding on average $28 USD for this job
User Avatar
I am experienced php developer and web designer with the depth knowledge related to MySQL,Laravel,Code Ignitor,WordPress,MSSQL,JSON,JAVASCRIPT,AJAX,XML,jQuery,CSS,HTML5,Material Designing with the integration of web technologies. I have worked as Php & Web developer in industry and now i am full time freelancer and having the experience of huge and live projects. I can design the web pages with the backend of php and I have also experience of query optimization and performance management through php support. I am finding one startup like you so i can provide my skills to IT market and I can give you 100% surity for quality work in minimum time sir. I have also launched eCommerce Product for pharmacy industry and launched android app on play store as well , I have great control in android with backend of php webservices and api generation with JSON integration. I can work at anytime with the great satisfactions,quality output and result in your hand with the fulfilling your requirements for sure. Waiting for your positive response , so we can start the work soon ..
$25 USD in 1 day
5.0 (475 reviews)
7.6
7.6
User Avatar
HI, can help you in the project to break and manage the string to different way. please let me know when we can start working. Looking forward for your response. Thanks.
$40 USD in 1 day
5.0 (151 reviews)
6.7
6.7
User Avatar
Hi there. I able to start right now. Ping me. Thank you. With regards. Yegor. ∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞∞
$50 USD in 1 day
5.0 (40 reviews)
6.2
6.2
User Avatar
Hi! Assuming you want this wrapped as a funcion which you can call passing the raw string to it and getting back the array of output strings back, I have couple questions. 1) Intermittent spaces won't matter regarding the order of applying the multiple character sequences, if more than just one is present? 2) How the code should respond in case there's an open character sequence(there's an left square bracket but no corresponding right suqre bracket is present(typing mistakes could and do occur quite often): a) Extend the characters range to the end of the string, if there's no intermittent space characters present, or until the first space or b) Cease the further processing and return some error string back? Regards, Dobri
$20 USD in 1 day
5.0 (162 reviews)
6.0
6.0
User Avatar
Update: I finished creating the function (and tested it with all examples you gave). Choose me and I'll give you the PHP file immediately. Original Bid: Hello. I'm an expert in PHP programming. I can easily create code to do string expansions like this. My script will be very efficient. Hire me now and I'll get the code to you within 24 hours. Thank you for your consideration.
$29 USD in 1 day
5.0 (36 reviews)
5.5
5.5
User Avatar
Hi, i can work with you into site topic and provide strong fast code thanksHi, i can work with you into site topic and provide strong fast code thanks
$25 USD in 1 day
5.0 (92 reviews)
5.7
5.7
User Avatar
Hi, I am PHP coder any can deliver function. It's a kind of alphanumeric permutation. But 1 thing is not clear to me: You are saying that the group are valid when they are at the beginning or at the end. But in your examples the groups are also somewhere in the middle of the string. So your examples are all invalid??? Is there a limit for chars in the groups? Regards, Ozzy
$30 USD in 2 days
5.0 (31 reviews)
5.3
5.3
User Avatar
We Believe in Delivering Perfect Work and Providing Full Satisfaction to Our Client . We also Insure to Deliver the Work in the given Time Frame . we have highly Qualified Professionals in our team
$17 USD in 1 day
4.7 (23 reviews)
4.6
4.6
User Avatar
Please come on chat and provide me an opportunity , i have 5 year of experience in php and can convert letters into its actual strings according to your need , so please message me. Thanks
$15 USD in 1 day
4.3 (68 reviews)
4.8
4.8
User Avatar
Dear client. I've read your project description carefully and very interested. Let's discuss over chat and get started. Waiting for your reply. Regards.
$50 USD in 1 day
4.4 (22 reviews)
4.5
4.5
User Avatar
Its a simple task to finish in 2 to 3 hours... accept the bi, i will start working on it right now and deliver it ASAP.
$20 USD in 1 day
4.9 (3 reviews)
2.4
2.4
User Avatar
Hi, I can do this job for you. Please let me know when we need to start work on it so we can make it done asap. Looking forward to your response. Thanks.
$15 USD in 1 day
5.0 (1 review)
0.8
0.8
User Avatar
This can be done very quickly. This specific problem takes me back to the earliest parts of my career when we would have coding challenges such as this.
$25 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
After reading your entry, im fairly confident that I can help you with the function, I should be able to deliver it by today at around 10pm PST
$27 USD in 1 day
0.0 (0 reviews)
0.0
0.0
User Avatar
Just talk to me and we will resolve this problem! In this case the solution is to see with a little more detail
$29 USD in 1 day
0.0 (0 reviews)
0.0
0.0

About the client

Flag of COLOMBIA
BOGOTA, Colombia
0.0
0
Payment method verified
Member since Feb 1, 2019

Client Verification

Thanks! We’ve emailed you a link to claim your free credit.
Something went wrong while sending your email. Please try again.
Registered Users Total Jobs Posted
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Loading preview
Permission granted for Geolocation.
Your login session has expired and you have been logged out. Please log in again.