Search found 189 matches

by kaveh1000
Mon Mar 25, 2019 2:30 pm
Forum: Talking LiveCode
Topic: Find offset of first and last char of Word x in a field
Replies: 8
Views: 365

Re: Find offset of first and last char of Word x in a field

Bingo!!

LC and LCMark do it again.

Yup, both these work correctly:

Code: Select all

  put char (charindex of trueword 4 of fld 1) of fld 1
  put char (charindex of word 4 of fld 1) of fld 1
Thanks again Mark and others. Every answer adds to my knowledge and perhaps others' too...

Kaveh
by kaveh1000
Sun Mar 24, 2019 2:39 pm
Forum: Talking LiveCode
Topic: Find offset of first and last char of Word x in a field
Replies: 8
Views: 365

Re: Find offset of first and last char of Word x in a field

Thank you both. I opted for J-M's method as it is to extend to truewords. (I failed to mention truewords was what I really needed.) Thierry's solution is in my regex library to study, especially (?msx) , which I have not used. It is probably not useful to put my code here as it is very specific, but...
by kaveh1000
Sun Mar 24, 2019 12:09 pm
Forum: Talking LiveCode
Topic: Find offset of first and last char of Word x in a field
Replies: 8
Views: 365

Find offset of first and last char of Word x in a field

This probably has a simple answer but I can't find it!

I just need to find the offset of first and last char of say Word 5 in a field. How can I do that?

Kaveh
by kaveh1000
Wed Mar 20, 2019 2:19 pm
Forum: Talking LiveCode
Topic: Regex: Matching an empty character
Replies: 11
Views: 364

Re: Regex: Matching an empty character

Great. Thank you. That is the answer I was looking for. So at least:

- I have not put error in the expression
- it is not a bug

Thanks again. I will look for another method and report back if I find an elegant and fast solution
by kaveh1000
Wed Mar 20, 2019 1:23 pm
Forum: Talking LiveCode
Topic: Regex: Matching an empty character
Replies: 11
Views: 364

Re: Regex: Matching an empty character

Keenly look forward to the explanation, Thierry :-)

I am using very latest BBEdit (12.6.1)
by kaveh1000
Wed Mar 20, 2019 12:43 pm
Forum: Talking LiveCode
Topic: Regex: Matching an empty character
Replies: 11
Views: 364

Re: Regex: Matching an empty character

Hi Thierry

Thanks for you time as ever.

Does your solution require purchasing your software that does back-referencing? ;-)

The search string works in BBEdit, using the search string and replacing all with space.
by kaveh1000
Tue Mar 19, 2019 11:04 pm
Forum: Talking LiveCode
Topic: Regex: Matching an empty character
Replies: 11
Views: 364

Re: Regex: Matching an empty character

Hi Craig

Yes, I could do it with the beautiful LC script, but in a large text I think that one regex will be faster.

The main point of my query is whether LiveCode is not finding this by design, or am I doing something wrong, or is it a bug?

The regex works fine in other applications.

Kaveh
by kaveh1000
Tue Mar 19, 2019 8:44 pm
Forum: Talking LiveCode
Topic: Regex: Matching an empty character
Replies: 11
Views: 364

Regex: Matching an empty character

Probably a question for Thierry. ;-) As an example I am trying to replace: AGHV by A G H V i.e. space out any adjacent capital letters. So I search for an empty char which is preceded and followed by a cap letter and replace it by space: put replacetext( \ tGname, \ "((?<=[A-Z])(?=[A-Z]))", \ " ") \...
by kaveh1000
Wed Mar 06, 2019 4:05 pm
Forum: Talking LiveCode
Topic: backslash escaped in Option menu
Replies: 5
Views: 196

Re: backslash escaped in Option menu

Thank you so much all. I have an application where I need to auto-populate menus with text that has weird characters, including "\". So I will just have a function that converts these before populating the menu text.
by kaveh1000
Wed Mar 06, 2019 3:35 pm
Forum: Talking LiveCode
Topic: backslash escaped in Option menu
Replies: 5
Views: 196

Re: backslash escaped in Option menu

Thank you both. So what is the exact rule for rendering the content? Klaus mentioned HTML, but it is not setting the content as HTMLtext. When I put <b>text</b> I see the same text rendered. And why not just put the text verbatim without escaping? Sorry if it is elementary questions. I can achieve w...
by kaveh1000
Wed Mar 06, 2019 3:09 pm
Forum: Talking LiveCode
Topic: backslash escaped in Option menu
Replies: 5
Views: 196

backslash escaped in Option menu

Please see attached sample stack. It seems the backslash is used as an escape character, not a literal "\" in option menu content. Here is what the menu content entry is and what is seen in the menu choice: \text > "text" \ text > " text" \\text > "\text" Is this expected behaviour? I hope not!
by kaveh1000
Sat Mar 02, 2019 5:52 pm
Forum: Talking LiveCode
Topic: Improving the style of menu bar
Replies: 6
Views: 327

Re: Improving the style of menu bar

Thank you Jacqueline. That makes sense. The reason is that this is a substack and I wanted the menus to separate to the mainstack.

I guess I can just play with the styles to make them look better...
by kaveh1000
Fri Mar 01, 2019 11:30 pm
Forum: Talking LiveCode
Topic: Improving the style of menu bar
Replies: 6
Views: 327

Re: Improving the style of menu bar

Thanks. Great to know we can put icons in menus :-) But I juts want to have the look and feel of the option menu that naturally takes on the mac style...
by kaveh1000
Fri Mar 01, 2019 9:25 pm
Forum: Talking LiveCode
Topic: Improving the style of menu bar
Replies: 6
Views: 327

Improving the style of menu bar

I am creating a menu bar using "Menu Builder". It works well, but the style is very basic when the menu is inside a stack. When it is set as the stack menubar, it looks good as it takes on the theme of the operating system. Please see attached screenshot of the two cases. Is it possible to have the ...
by kaveh1000
Wed Feb 20, 2019 4:29 pm
Forum: Talking LiveCode
Topic: Problem with regex at start of line
Replies: 6
Views: 228

Re: Problem with regex at start of line

I normally use the backslash breaks with multi-parameter functions. The indenting makes things more readable, especially when there is regex as a parameter!!

Go to advanced search