Re: Catch line indentation
| From: | German Geek | Date: | Sat, 29 Oct 2016 21:30:08 +0000 |
| Subject: | Re: Catch line indentation | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-325804@lists.php.net to get a copy of this message | ||
Try with 1 instead of 0 or drop the "(" and ")".
On Sun, Oct 30, 2016, 08:13 Narcis Garcia <informatica@actiu.net> wrote:
> I've seen that, for some rare strings, neither of those work as
> expected. Finally I've choosen the "procedural" method (more clear and
> secure to work):
>
> $s = ' <table>...</table>';
> $indentation = mb_substr($s, 0, mb_strlen($s) - mb_strlen(ltrim($s)));
>
> Thanks to everyone for the ideas and help.
>
>
> El 29/10/16 a les 16:02, Narcis Garcia ha escrit:
> > Those two expressions are the only that work:
> >
> > preg_replace('/^(\s*)\S*/','${1}','
> > <table>...</table>')
> > preg_filter('/^(\s*)\S*/','${1}','
> > <table>...</table>')
> >
> > Which one of those functions is the best to be used for this case?
> >
> >
> > El 29/10/16 a les 07:52, richard gray ha escrit:
> >> On 28/10/2016 14:15, Christoph M. Becker wrote:
> >>>
> >>> Shouldn't that be
> >>>
> >>> ^( *)[^ ]
> >>>
> >>> instead?
> >>>
> >> or maybe even ..?
> >>
> >> ^(\s*)
> >>
> >> Rich
> >>
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>