Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> how do you find a "__bold__ in a phrase" or "bold in a __phrase__" reliably?

Can't you use regex?

_[^_\n\r]+_

edit: I think double underscores are easier, you should be able to use __.+__ and there's no reason to have to avoid matching single_underscore words.



I meant searching for a "bold in a phrase" phrase when it can have various markup in arbitrary places (also, it's not just __, you might have some other valid marker) But anyway, you can't really use regex here as it's too complicated and error prone for such a frequently needed operation, you need a better mechanism line index or a built in functionality to ignore all markup


So look for **? This has been working well for me.


look where? it can be any other marker, and it can be nested, and it can be in any position, you can't craft a regex on the fly to capture that, your regex will be longer than the phrase.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: