Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hello
I have a string a variable length that looks like this
$string = "hello my * name is Rob * and * I am a very nice person * at least * I think * so"I need to split the string at the "*" character which comes before position x, where x = 30. In the example above:
$part1 = "hello my * name is Rob * and *"; $part2 = "I am a very nice person * at least * I think * so"
I suspect there must be some backwards regex in Perl. Any idea?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: split string at variable position with matching
by choroba (Cardinal) on Sep 11, 2021 at 20:11 UTC | |
by AnomalousMonk (Archbishop) on Sep 12, 2021 at 02:28 UTC | |
by LanX (Saint) on Sep 11, 2021 at 20:44 UTC | |
by choroba (Cardinal) on Sep 11, 2021 at 22:01 UTC | |
|
Re: split string at variable position with matching
by tybalt89 (Monsignor) on Sep 11, 2021 at 20:19 UTC | |
|
Re: split string at variable position with matching
by LanX (Saint) on Sep 12, 2021 at 00:48 UTC | |
|
Re: split string at variable position with matching
by jwkrahn (Abbot) on Sep 12, 2021 at 01:38 UTC | |
|
Re: split string at variable position with matching
by Anonymous Monk on Sep 12, 2021 at 14:45 UTC |