I've never worked with Hebrew characters so I'm not sure if this will work,
However I think you can implement a function with a while loop using patindex
- you'll need a variable for holding the reversed english part @EngTemp
- a variable to hold the substring currently being processed @SubTemp
- a variable to hold the remaining text in the string that still needs to be processed @SubNext
- a variable to hold the length of the current substring @Len
- an output variable @Out
Steps:
- Take a string input, put it into @SubNext
while PatIndex('%[^a-z]%', @SubNext) > 0
- substring to the pat index store in @SubTemp, also trim @SubNext to the patindex
- store the length of the @SubTemp in @Len
- if @Len > 1; set @Out = @Out + @EngTemp + @SubTemp; Set @EngTemp = ''
(This step assumes the possibility that there could be cases where the english string is not the end of the line)
- if @Len = 1; set @EngTemp = @SubTemp + @EngTemp
- if @Len = 0; set @Out = @Out + @EngTemp
(At this point the loop should close also)
I'm going to play with this when I have some time and post actual code, sorry if my scribbles doesn't make any sense