Skip to content

Commit

Permalink
update find-links function
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushgaud committed Sep 4, 2024
1 parent ab3d2ec commit cd268fe
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions src/wrike_ist/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,17 @@
;; (not-empty (re-seq #"\bhttps://dev\.azure\.com/[^/]+/[^/]+/_workitems/edit/\d+\b" text)))
(defn find-links
[text]
(let [wrike-pattern #"https://www\.wrike\.com/open\.htm\?id=\d+"
azure-pattern #"https://dev\.azure\.com/[^/]+/[^/]+/_workitems/edit/\d+"]
(let [wrike-matches (re-seq wrike-pattern text)
azure-matches (re-seq azure-pattern text)]
(let [wrike-pattern #"\bhttps://www\.wrike\.com/open\.htm\?id=\d+\b"
azure-pattern #"\bhttps://dev\.azure\.com/[^/]+/[^/]+/_workitems/edit/\d+\b"
combined-pattern (re-pattern (str wrike-pattern "|" azure-pattern))]
(let [matches (re-seq combined-pattern text)]
(do
;; Print debug information
(js/console.log "Wrike Pattern:" wrike-pattern)
(js/console.log "Azure Pattern:" azure-pattern)
(js/console.log "Combined Pattern:" combined-pattern)
(js/console.log "Text to Search:" text)
(js/console.log "Wrike Matches Found:" wrike-matches)
(js/console.log "Azure Matches Found:" azure-matches)

;; Combine results
(cond
(seq wrike-matches) wrike-matches
(seq azure-matches) azure-matches
:else (js/console.log "No matching links found"))))))

;; Example usage
(find-links "Here are some links: https://www.wrike.com/open.htm?id=123456 and https://dev.azure.com/organization/project/_workitems/edit/98765")

(js/console.log "Matches Found:" matches)
(if (seq matches)
(distinct matches)
(js/console.log "No matching links found"))))))

(defn extract-details
[pr-obj]
Expand Down

0 comments on commit cd268fe

Please sign in to comment.