Split string into smaller part with constrain [PHP RegEx HTML]
- by Sadi
Hello,
I need to split long string into a array with following constrains:
Each part will have a limited number of character (e.g. not more than 8000 character)
Each part can contain multiple sentences (delimited by . [full stop]) but never a partial sentences. Except if the last part of the string (as last part may not have any full stop.
The string may contain HTML tags. But the tag can not be divided as ( to ). That means HTML tag should be intact. But starting tag and ending tag can be stay on different segment/chunk.
I think regular expression with preg_split can do it. Would please help me with the proper RegEx.
Thank you
Sadi