Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
I want to compare paragraphs by sentence. I can split the paragraph into sentences when there is a line feed and/or carriage return. Do you have any suggestions, how I may split a paragraph into separate sentences with numbered lists.
1. Bicycle racks shall be installed on a durable surface, preferably near the associate entrance without pedestrian route conflicts. 2. Designated bicycle corridors connecting the public right-of-way with the bicycle parking shall not be provided unless required per local code. If required and provided, the bike corridor shall consist of two (1.2m) wide pavement lanes (on the outside of travel lanes, one in each direction) separated from the vehicle travel lane by pavement striping. Bike lanes should be signed and striped in accordance to local code and regulations for all traffic signs. 3. At sites with a designated bike corridor, bikes should not travel on sidewalks (with exception of parking) or in vehicle travel lanes.
I can split this paragraph with a (period) (space), but this will also split the 1, 2, 3, etc.
The desired output is three records, one for each sentence.
Please advise.
Solved! Go to Solution.
One possible method is finding the positions of all the digits and then selecting those digit positions immediately followed by a period and a space. Those are the positions you need to split on.
Here's an example query putting this all together:
let
Source = Table.FromRows({{"1. Bicycle racks shall be installed on a durable surface, preferably near the associate entrance without pedestrian route conflicts. 2. Designated bicycle corridors connecting the public right-of-way with the bicycle parking shall not be provided unless required per local code. If required and provided, the bike corridor shall consist of two (1.2m) wide pavement lanes (on the outside of travel lanes, one in each direction) separated from the vehicle travel lane by pavement striping. Bike lanes should be signed and striped in accordance to local code and regulations for all traffic signs. 3. At sites with a designated bike corridor, bikes should not travel on sidewalks (with exception of parking) or in vehicle travel lanes."}}, type table [Text = text]),
SplitToList = Table.AddColumn(Source, "Split", each
[
Digits = Text.PositionOfAny([Text], {"0".."9"}, Occurrence.All),
Positions = List.Select(Digits, (i) => Text.Middle([Text], i + 1, 2) = ". "),
Split = Splitter.SplitTextByPositions(Positions)([Text])
][Split], type {text}),
ExplandList = Table.ExpandListColumn(SplitToList, "Split")
in
ExplandList
Hi @MarkusEng1998, another solution here:
Result:
let
Source = Table.FromRows({{"1. Bicycle racks shall be installed on a durable surface, preferably near the associate entrance without pedestrian route conflicts. 2. Designated bicycle corridors connecting the public right-of-way with the bicycle parking shall not be provided unless required per local code. If required and provided, the bike corridor shall consist of two (1.2m) wide pavement lanes (on the outside of travel lanes, one in each direction) separated from the vehicle travel lane by pavement striping. Bike lanes should be signed and striped in accordance to local code and regulations for all traffic signs. 3. At sites with a designated bike corridor, bikes should not travel on sidewalks (with exception of parking) or in vehicle travel lanes."}}, type table [Text = text]),
Ad_Splitted = Table.AddColumn(Source, "Splitted", each
[ a = Text.Split([Text], " "),
b = List.Select(a, (x)=> Text.EndsWith(x, ".")),
delimiters = List.Select(b, (x)=> (try Number.From(Text.Remove(x, ".")) otherwise false) is number),
d = List.Accumulate( {0..List.Count(delimiters)-1}, {}, (s,c)=> s & { try delimiters{c} & " " & Text.Trim(Text.BetweenDelimiters([Text], delimiters{c}, delimiters{c+1})) otherwise delimiters{c} & " " & Text.Trim(Text.AfterDelimiter([Text], delimiters{c})) } )
][d], type list),
ExpandedSplitted = Table.ExpandListColumn(Ad_Splitted, "Splitted")
in
ExpandedSplitted
One possible method is finding the positions of all the digits and then selecting those digit positions immediately followed by a period and a space. Those are the positions you need to split on.
Here's an example query putting this all together:
let
Source = Table.FromRows({{"1. Bicycle racks shall be installed on a durable surface, preferably near the associate entrance without pedestrian route conflicts. 2. Designated bicycle corridors connecting the public right-of-way with the bicycle parking shall not be provided unless required per local code. If required and provided, the bike corridor shall consist of two (1.2m) wide pavement lanes (on the outside of travel lanes, one in each direction) separated from the vehicle travel lane by pavement striping. Bike lanes should be signed and striped in accordance to local code and regulations for all traffic signs. 3. At sites with a designated bike corridor, bikes should not travel on sidewalks (with exception of parking) or in vehicle travel lanes."}}, type table [Text = text]),
SplitToList = Table.AddColumn(Source, "Split", each
[
Digits = Text.PositionOfAny([Text], {"0".."9"}, Occurrence.All),
Positions = List.Select(Digits, (i) => Text.Middle([Text], i + 1, 2) = ". "),
Split = Splitter.SplitTextByPositions(Positions)([Text])
][Split], type {text}),
ExplandList = Table.ExpandListColumn(SplitToList, "Split")
in
ExplandList