If you want to limit the number of splits performed by Python regular expression split, you can use the optional maxsplit parameter. By specifying a value for maxsplit, you can control the maximum number of splits to be made. For example: text = "apple,banana,cherry,date,elderberry" fruits = re.split(r",", text, maxsplit=2) print(fruits) The output will be: ['apple', 'banana', 'cherry,date,elderberry'] In this case, only the first two commas are considered for splitting the string.